* Builds a new model instance and calls save on it. * * @see * {@link Model.build} * @see * {@link Model.save} * * @param {object} values Hash of data values to create new record with * @param {object} [options] Build
(values, options)
| 2221 | * |
| 2222 | */ |
| 2223 | static async create(values, options) { |
| 2224 | options = Utils.cloneDeep(options || {}); |
| 2225 | |
| 2226 | return await this.build(values, { |
| 2227 | isNewRecord: true, |
| 2228 | attributes: options.fields, |
| 2229 | include: options.include, |
| 2230 | raw: options.raw, |
| 2231 | silent: options.silent |
| 2232 | }).save(options); |
| 2233 | } |
| 2234 | |
| 2235 | /** |
| 2236 | * Find a row that matches the query, or build (but don't save) the row if none is found. |