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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>