Hello,
I have a nested related database and I’m retrieving the data as follow:
$Criteria = new CDbCriteria();
$Criteria->compare('company_id',$userObject->profile->company_id);
$Criteria->with=array('employee'=>array('select'=>'name'), 'days'=>array('with'=>array('entries'=>array('with'=>array('job','overhead')))));
$this->_model=TimesheetEmployee::model()->findAll($Criteria);
Above returns all matching related ‘entries’ as expected however I’m wondering how I can add another condition for ‘entries’ so it also matches the column ‘day’ of its related table with value of ‘day’ of it’s own column?
Both tables have ‘day’ column
table-1
id:1, day:mon
table-2
id:1, related_id:1, day:mon
id:2, related_id:1, day:tue
Also, the line below doesn’t seem to be working, instead of only selecting and returning ‘name’ column it returns all columns
'employee'=>array('select'=>'name')