How to query with parent table condition in yiiframework

 

  1. $lists = ProfileInformation::model()->with(array(
  2.             ‘user’ => array(
  3.               ‘condition’ => “user.user_type = ’Care Worker’”,
  4.             )
  5.           ))->findAll();

 

Here ‘user’ is a relational key which is declare ProfileInformation model.