YIi Active Record selecting fixed fields -
i using active record queries below fetching records query below selects possible columns. wanted select 2 columns ( firstname, lastname )
profile::model()->findbyattributes(array('id'=>'1'))   to select firstname below works, how can add lastname select in statement without using cdbcriteria.
$first = profile::model()->findbyattributes(array('user_id'=>'1'))->firstname   second, have used relations lazy load records , when needed , there selecting fields needed improve performance overall.
without using cdbcriteria, can below
$first=profile::model()->find(array(     'select'=>'firstname,lastname',     'condition'=>'user_id=:uid',     'params'=>array(':uid'=>1), ));      
Comments
Post a Comment