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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -