I have the following tables:
user (id, cv_personal_data_id),
cv_personal_data (id, firstname, surname, gender, address, ...),
cv_laboral_exp (id, user_id, position, seniority,... ),
cv_study (id, user_id, name, institution, average, ...),
cv_language (id, user_id, language_name, writing_level, ...)
In my User model, I defined the following relationships:
public function relations()
{
return array(
'cvLaboralExps' => array(self::HAS_MANY, 'CvLaboralExp', 'user_id'),
'cvLanguages' => array(self::HAS_MANY, 'CvLanguage', 'user_id'),
'cvStudies' => array(self::HAS_MANY, 'CvStudy', 'user_id'),
'cvPersonalData' => array(self::BELONGS_TO, 'CvPersonalData', 'cv_personal_data_id'),
}
The problem is this: logged in as a company, I need to display a CGridView, which lists all the users and can be found in any of the fields of related tables, such as "position" (from cv_laboral_exp), "language_name" '(from cv_languages) etc. I cannot find a solution to search for fields that come from the HAS_MANY relationship. I tried adding the expression 'with' to the criteria $ in the search () method of the User class to try to find the user's position in the work experience, but to no avail:
$criteria->compare('cvLaboralExps.position',$this->cvLaboralExps,true);
$criteria->with = array('cvLaboralExps'=>array('select'=>'cvLaboralExps.position','together'=>true));
, , CV . , - , /.