Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Trouble Searching Through Relations

$
0
0
: Screenshot from 2013-02-07 15:10:40.png


I need search first_name and last_name through relations of the model MessageLog

I tried things like:

public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;
		$criteria->with=array();

		$criteria->compare('id',$this->id);		
		$criteria->compare('message_id',$this->message_id);
		//$criteria->compare('media_id',$this->media_id);
                
                array_push($criteria->with,'media.person');		
		$criteria->addSearchCondition('LOWER(media.person.first_name)', strtolower($this->person_id));

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}



or

      array_push($criteria->with,'media');		
      $criteria->addSearchCondition('LOWER(media.person.first_name)', strtolower($this->person_id));


But everything I've tried fail

i will appreciate your help. best regards...

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>