I'm not sure which part i have done wrong but i keep getting php error about array when i try to run
$model = new video;
$video = $model->with('team')->findAll();
my video model
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'comments'=>array(self::HAS_MANY,'comment','video_id'),
'tags'=>array(self::HAS_ONE,'tag','video_id'),
'team'=>array(self::HAS_ONE,'team','video_id','with'=>'members'),
);
}
00573: {
00574: // determine the primary key value
00575: if(is_string($this->_pkAlias)) // single key
00576: {
00577: if(isset($row[$this->_pkAlias]))
00578: $pk=$row[$this->_pkAlias];
00579: else // no matching related objects
00580: return null;
00581: }
00582: else // is_array, composite key
00583: {
00584: $pk=array();
00585: foreach($this->_pkAlias as $name=>$alias)
00586: {
00587: if(isset($row[$alias]))
00588: $pk[$name]=$row[$alias];
00589: else // no matching related objects
00590: return null;
00591: }
00592: $pk=serialize($pk);
00593: }
00594:
00595: // retrieve or populate the record according to the primary key value
00596: if(isset($this->records[$pk]))
00597: $record=$this->records[$pk];
i always get error at line 585 on Invalid argument supplied for foreach() of CActivefind
i only retrive all record and get record information from both tables…
i know it can be done with simplemysql join statement but if it can be done with Yii relation will be easier logic implementation next time