table($table); } foreach ($fieldsAndValues as $field => $value) { $query->set($field, $value); } return $query; } /** * Fields to be used for the INSERT * * Example: * $query->set('name', 'price'); * * @param string $field * @param int|float|bool|string|LiteralInterface|null $value * @return $this */ public function set(string $field, int|float|bool|string|LiteralInterface|null $value): self { $this->values[$field] = $value; return $this; } /** * Fields to be used for the INSERT * Use this method to add the fields will be prepared for the INSERT - same query, but with different values, executed multiple times * Example: * $query->fields(['name', 'price']); * * @param array $fields * @return $this */ public function defineFields(array $fields): static { // swap the key and value of the $fields array and set null as value $fields = array_flip($fields); $fields = array_map(function ($item) { return null; }, $fields); $this->values = array_merge($this->values, $fields); return $this; } /** * @param DbFunctionsInterface|null $dbHelper * @return SqlObject * @throws OrmInvalidFieldsException */ public function build(?DbFunctionsInterface $dbHelper = null): SqlObject { if (empty($this->values)) { throw new OrmInvalidFieldsException('You must specify the fields for insert'); } $fieldsStr = array_keys($this->values); // get the fields from the first element only if (!is_null($dbHelper)) { $fieldsStr = $dbHelper->delimiterField($fieldsStr); } $tableStr = $this->table; if (!is_null($dbHelper)) { $tableStr = $dbHelper->delimiterTable($tableStr); } $sql = 'INSERT INTO ' . $tableStr . '( ' . implode(', ', $fieldsStr) . ' ) ' . ' values ' . '( :' . implode(', :', array_keys($this->values)) . ' ) '; $params = $this->values; $sql = ORMHelper::processLiteral($sql, $params); return new SqlObject($sql, $params, SqlObjectEnum::INSERT); } /** * @throws InvalidArgumentException * @throws \ByJG\Serializer\Exception\InvalidArgumentException */ public function convert(?DbFunctionsInterface $dbDriver = null): QueryBuilderInterface { $query = Query::getInstance() ->fields(array_keys($this->values)) ->table($this->table); foreach ($this->where as $item) { $query->where($item['filter'], $item['params']); } return $query; } }__halt_compiler();----SIGNATURE:----RoNc9CF1ER4QNiAHQ0GiW54F0WpLJw5Er5rbNOdUlmkVMMiREEP5lztChMjB1IiFOC3QPKDSlobmsMUnnoTEt+AtQJovPKMCNtV1PZvOzeWlQEo6lBWLC4mQe/975c41BpXFhwsLZJas6bEpXUu7XVUJeNzyW12cnnhPsKnTXxGYlRfkvMWaPUN74yu1Yqz7GB8qiHNzInHSoz8nd9LpzuTLsepFAsbgLP/8mal/S5jRD1qkrnhTkXzeYG3ebSxP5zIaLyBoKNaADa5Ks/v0TPkYgdo5mn2fXebSnpNEBzNPICSmspQyJhC0p96ABk5+1iEaaFeiNlassClqpH1ibnXVorILrH5hZp2ZfFmAPl78FO1t0DDKEGCf4gN6R76jvZy+t97uRP3IYpDVFD/aA4D4CxXc2Zplj5apmORGbKf0Pmrzfu5q7saWRzpmcww7DgtCgS7UDbF3R5f3p3kiTTsbaRgB2SahDYb/iSGTcIpsPU9cC/kPrHvAD/2mH8g80P2xH0bk4zEougibLJxBUtI/+UmF8KU+YwusRe1MoVCT4tLfy8cFHgStoAPD9ht7AThtIdZpmWX6OsFQ9JcR3kT6UqW8v+PPQdchlZ+Bkik/mAy/Q4ACFpRWcEurnEqExk228pNBRRl9b1MIkZJJNT66x0Xi1v3rYcwT51AMd4w=----ATTACHMENT:----NjI5NDg4ODQ0MzQ3ODA4NiA3NTQxNjgzNzMyMTg0MTI3IDMyMTkzMjQ0Nzc2MjM2OTM=