table($table); foreach ($fieldNames as $fieldname) { $this->fields[$fieldname] = []; } } public static function getInstance(string $table, array $fieldNames): static { return new InsertBulkQuery($table, $fieldNames); } /** * @throws OrmInvalidFieldsException */ public function values(array $values, bool $allowNonMatchFields = true): static { if (array_diff(array_keys($this->fields), array_keys($values))) { throw new OrmInvalidFieldsException('The provided values do not match the expected fields'); } if (!$allowNonMatchFields && array_diff(array_keys($values), array_keys($this->fields))) { throw new OrmInvalidFieldsException('The provided values contain more fields than expected'); } foreach (array_keys($this->fields) as $field) { $this->fields[$field][] = $values[$field]; } return $this; } /** * @param DbFunctionsInterface|null $dbHelper * @return SqlObject * @throws OrmInvalidFieldsException */ public function build(?DbFunctionsInterface $dbHelper = null): SqlObject { if (empty($this->fields)) { throw new OrmInvalidFieldsException('You must specify the fields for insert'); } $tableStr = $this->table; if (!is_null($dbHelper)) { $tableStr = $dbHelper->delimiterTable($tableStr); } // Extract column names $columns = array_keys($this->fields); // Get the number of rows $rowCount = count(current($this->fields)); // Initialize placeholders and parameters $placeholders = []; $params = []; // Build placeholders and populate $params for ($i = 0; $i < $rowCount; $i++) { $rowPlaceholders = []; foreach ($columns as $j => $col) { $paramKey = "p{$i}_$j"; // Generate the parameter key $rowPlaceholders[] = ":$paramKey"; // Add to row placeholders $params[$paramKey] = $this->fields[$col][$i]; // Map parameter key to value } $placeholders[] = '(' . implode(', ', $rowPlaceholders) . ')'; // Add row placeholders to query } if (!is_null($dbHelper)) { $columns = $dbHelper->delimiterField($columns); } // Construct the final SQL query $sql = sprintf( "INSERT INTO %s (%s) VALUES %s", $tableStr, implode(', ', $columns), implode(', ', $placeholders) ); $sql = ORMHelper::processLiteral($sql, $params); return new SqlObject($sql, $params); } public function convert(?DbFunctionsInterface $dbDriver = null): QueryBuilderInterface { throw new InvalidArgumentException('It is not possible to convert an InsertBulkQuery to a Query'); } }__halt_compiler();----SIGNATURE:----gyJBQrnU+YLH+IO+1KQcZjANuE32LaNFSDYxBPMAhrIKTk3xR572JgoT4gDHB+1B5N0+4BxdKdxLKsvDNeKg/cJkFPQCWVroRulWXhb3W7zIrMz10RNeR6RXe7msAwaQELqojeTHy+DlxNbCX4RNtMrB+PGjQBRg8c2y56D2SpzUUuSzCTfmBhq2t8za+fTgRfRCuU8uAQzkv+hJI62MlrjhveWuBWFw2puwFUvRuHyKYi1dZK8RhqIayarYBipAP3pITPm3QWpjqkml5dy9JloYpZYTP4Fd+7/WiR5pgFBJJQKKjuQjb4wwJkuR3J5Lordi9aAlkCz73G8uzp0WRi82/GbmJpNEZKqinAHtE45cqW2RctguQmHlLGDvM7j12C0N1Fm8UBgThy++LslCCjEweybbTwVqJ+XzTDul5q5gP3fAH0nHITcRNBj3qjlpJdNZrRnFT18KKHAatMNXvr+CEsFWqkeuX3MwBLRfGBNY18F2DkYFakE+5RF9z16dJy8+k9FEmobVUWn5Z7pvO17LGvrHrmgYNDykree6gua4wjaDD2S2f5wy7uHlyIswaOm2ORYv5noSnG3IVDKM2+1/IG1QaUHe3HAycOQ6QN8FIBDJKi3VDuPv8Xyz6kXBIRIOespaqlMCrC6qn50tATVkOfdtTs+e6juTHnB1sac=----ATTACHMENT:----NDczNjg2NTU2ODExODc4NyA2MzIzODg1NjYxMjA5MTg0IDk0ODUyOTEyMzUyNDg2MjU=