protected function doInsert(array
$data) { $escape =
$this->escape;
$this->escape =
[];
// Require non-empty primaryKey when
// not using auto-increment feature
if (!
$this->useAutoIncrement &&
empty($data[$this->primaryKey
])) { throw DataException::
forEmptyPrimaryKey('insert'
);
} $builder =
$this->
builder();
// Must use the set() method to ensure to set the correct escape flag
foreach ($data as $key =>
$val) { $builder->
set($key,
$val,
$escape[$key] ?? null
);
} if ($this->allowEmptyInserts &&
empty($data)) { $table =
$this->db->
protectIdentifiers($this->table, true, null, false
);