Hello!
I have a table
And generated schema
But when i try create new object and row like this:
$iid = substr(md5(time()),0,7);
$modx->log(xPDO::LOG_LEVEL_ERROR, $iid);
$dateUpload = date('Y-m-d H:i:s');
$manufacturer = isset($manufacturer)?$manufacturer:$customManufacturer;
//Добавляем данные
$row = $modx->newObject('Forms');
$row->fromArray(array(
'id' => $iid,
'country' => $country,
'section' => $section,
'manufacturer' => $manufacturer,
'comment' => $comment,
'email' => $e_mail,
'path2image' => $filename,
'dateUpload' => $dateUpload
));
$modx->log(xPDO::LOG_LEVEL_ERROR, $row->save());
I find out no full query and trying to add empty id field by log like this:
INSERT INTO `x_museum_forms` (`country`, `section`, `manufacturer`, `comment`, `email`, `path2image`, `dateUpload`) VALUES ('DZ', 'sec1', 'man2', 'cxv', '[email protected]', '201307119092013-07-10_18_01_56-open.png', '2013-07-11 09:09:41')
Array
(
[0] => 23000
[1] => 1062
[2] => Duplicate entry '' for key 'PRIMARY'
)
WHY?))