* Builds a new model instance and calls save on it. * * @see * Model.build * @see * Model.save * * @param {object} values Hash of data values to create new record with * @param {object} [options] Build
(values, options)
| 2300 | * |
| 2301 | */ |
| 2302 | static async create(values, options) { |
| 2303 | options = Utils.cloneDeep(options || {}); |
| 2304 | |
| 2305 | return await this.build(values, { |
| 2306 | isNewRecord: true, |
| 2307 | attributes: options.fields, |
| 2308 | include: options.include, |
| 2309 | raw: options.raw, |
| 2310 | silent: options.silent |
| 2311 | }).save(options); |
| 2312 | } |
| 2313 | |
| 2314 | /** |
| 2315 | * Find a row that matches the query, or build (but don't save) the row if none is found. |