You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case you need to specify custom PK->FK association you can define it as array('fk'=>'pk'). For composite keys it will be array('fk_c1'=>'pk_с1','fk_c2'=>'pk_c2').
(docblock in source)
Not talking about the composite key case here. Simply using the same syntax to explicitly name single foreign column => single local column.
If you have an AR child class with this:
// model's own primary key is (`nodeId`)
public function relations()
{
return array(
'parentRelationRecord' => array(
self::HAS_ONE,
'ProjectNodeParent',
array('nodeId' => 'nodeId'), // trivial case
),
'status' => array(
self::HAS_ONE,
'Status',
array('id' => 'statusId'),
),
);
}
229 // update all not anymore related records
230 $criteria=new ECompositeDbCriteria();
231 $criteria->addNotInCondition(CActiveRecord::model($relation[1])->tableSchema->primaryKey, $newPKs);
232 // @todo add support for composite primary keys
233 $criteria->addColumnCondition(array($relation[2]=>$this->owner->getPrimaryKey()));
At this point, PHP is trying to use an array as an array key, which it can't. This causes the warning.
This call is initiated from CActiveRecord::afterSave and the event it triggers.
The text was updated successfully, but these errors were encountered:
To quote from the Yii AR documentation:
Not talking about the composite key case here. Simply using the same syntax to explicitly name single foreign column => single local column.
If you have an AR child class with this:
... saving triggers a PHP warning in EActiveRecordbehavior::afterSave Line #233
At this point, PHP is trying to use an array as an array key, which it can't. This causes the warning.
This call is initiated from CActiveRecord::afterSave and the event it triggers.
The text was updated successfully, but these errors were encountered: