Definition:
public array findAllByPk(mixed $pk, mixed $condition='', array $params=array ( ))
(refer http://www.yiiframework.com/doc/api/1.1/CActiveRecord#findAllByPk-detail)
Explanation:
Find all active records with specified primary key
$pk can be either
1. string -> single-key primary key
2. array -> single-composite-key primary key
(refer createPkCriteria in yii\framework\db\schema\CDbCommandBuilder.php)
Example:
1. $model = MyModel::model()->findAllByPk($id);
2. $model = MyModel::model()->findAllByPk(array('pkCol1'=>$col1, 'pkCol2'=>$col2));
Internal:
findAllByPk($pk, $condition, $param)
|-$criteria = createPkCriteria($this->getTableSchema(),$pk,$condition,$params,$prefix)
Note: $criteria is a CDbCriteria
|-query($criteria, TRUE)
Note: TRUE means select all active records
Showing posts with label FindAllByPk(). Show all posts
Showing posts with label FindAllByPk(). Show all posts
Sunday, April 1, 2012
Subscribe to:
Posts (Atom)