Answer the question
In order to leave comments, you need to log in
How to correctly insert a row into a table that has multiple primary keys?
There is zend framework 1.12 and a model in which an array with three keys is used as a primary key
class Admin_Model_DbTable_Starring extends My_Db_Table
{
protected $_name = 'starring';
protected $_primary = array('play_id', 'person_id', 'role_id'); // если тут не массив, а строка с 1 ключом, то все норм
protected $_rowClass = 'My_Db_Table_Row';
public $prefix = 'str';
...
$starringModel = new Admin_Model_DbTable_Starring();
$row = $starringModel->createRow();
$row->play_id = $play_id;
$row->person_id = $person_id;
$row->role_id = $role_id;
$row->status = 2;
$row->save();
Answer the question
In order to leave comments, you need to log in
There cannot be more than one primary key.
Actually, it can't.
There can only be one primary key.
But the primary key can be composite.
Judging by the characteristic php E_NOTICE, in zend fw the composite primary key is specified in some other way, because the code tries to cast $_primary to a string and receives E_NOTICE for this.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question