"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "framework/db/ar/CActiveRecord.php" between
yii-1.1.19.5790cb.tar.gz and yii-1.1.20.6ed384.tar.gz

About: Yii is a high-performance component-based PHP framework for developing large-scale Web applications. Hint: Yii 1.1 is now in maintenance mode.

CActiveRecord.php  (yii-1.1.19.5790cb):CActiveRecord.php  (yii-1.1.20.6ed384)
skipping to change at line 1457 skipping to change at line 1457
/** /**
* Finds a single active record with the specified condition. * Finds a single active record with the specified condition.
* @param mixed $condition query condition or criteria. * @param mixed $condition query condition or criteria.
* If a string, it is treated as query condition (the WHERE clause); * If a string, it is treated as query condition (the WHERE clause);
* If an array, it is treated as the initial values for constructing a {@ link CDbCriteria} object; * If an array, it is treated as the initial values for constructing a {@ link CDbCriteria} object;
* Otherwise, it should be an instance of {@link CDbCriteria}. * Otherwise, it should be an instance of {@link CDbCriteria}.
* @param array $params parameters to be bound to an SQL statement. * @param array $params parameters to be bound to an SQL statement.
* This is only used when the first parameter is a string (query conditio n). * This is only used when the first parameter is a string (query conditio n).
* In other cases, please use {@link CDbCriteria::params} to set paramete rs. * In other cases, please use {@link CDbCriteria::params} to set paramete rs.
* @return static the record found. Null if no record is found. * @return static|null the record found. Null if no record is found.
*/ */
public function find($condition='',$params=array()) public function find($condition='',$params=array())
{ {
Yii::trace(get_class($this).'.find()','system.db.ar.CActiveRecord '); Yii::trace(get_class($this).'.find()','system.db.ar.CActiveRecord ');
$criteria=$this->getCommandBuilder()->createCriteria($condition,$ params); $criteria=$this->getCommandBuilder()->createCriteria($condition,$ params);
return $this->query($criteria); return $this->query($criteria);
} }
/** /**
* Finds all active records satisfying the specified condition. * Finds all active records satisfying the specified condition.
skipping to change at line 1486 skipping to change at line 1486
$criteria=$this->getCommandBuilder()->createCriteria($condition,$ params); $criteria=$this->getCommandBuilder()->createCriteria($condition,$ params);
return $this->query($criteria,true); return $this->query($criteria,true);
} }
/** /**
* Finds a single active record with the specified primary key. * Finds a single active record with the specified primary key.
* See {@link find()} for detailed explanation about $condition and $para ms. * See {@link find()} for detailed explanation about $condition and $para ms.
* @param mixed $pk primary key value(s). Use array for multiple primary keys. For composite key, each key value must be an array (column name=>column va lue). * @param mixed $pk primary key value(s). Use array for multiple primary keys. For composite key, each key value must be an array (column name=>column va lue).
* @param mixed $condition query condition or criteria. * @param mixed $condition query condition or criteria.
* @param array $params parameters to be bound to an SQL statement. * @param array $params parameters to be bound to an SQL statement.
* @return static the record found. Null if none is found. * @return static|null the record found. Null if none is found.
*/ */
public function findByPk($pk,$condition='',$params=array()) public function findByPk($pk,$condition='',$params=array())
{ {
Yii::trace(get_class($this).'.findByPk()','system.db.ar.CActiveRe cord'); Yii::trace(get_class($this).'.findByPk()','system.db.ar.CActiveRe cord');
$prefix=$this->getTableAlias(true).'.'; $prefix=$this->getTableAlias(true).'.';
$criteria=$this->getCommandBuilder()->createPkCriteria($this->get TableSchema(),$pk,$condition,$params,$prefix); $criteria=$this->getCommandBuilder()->createPkCriteria($this->get TableSchema(),$pk,$condition,$params,$prefix);
return $this->query($criteria); return $this->query($criteria);
} }
/** /**
skipping to change at line 1519 skipping to change at line 1519
return $this->query($criteria,true); return $this->query($criteria,true);
} }
/** /**
* Finds a single active record that has the specified attribute values. * Finds a single active record that has the specified attribute values.
* See {@link find()} for detailed explanation about $condition and $para ms. * See {@link find()} for detailed explanation about $condition and $para ms.
* @param array $attributes list of attribute values (indexed by attribut e names) that the active records should match. * @param array $attributes list of attribute values (indexed by attribut e names) that the active records should match.
* An attribute value can be an array which will be used to generate an I N condition. * An attribute value can be an array which will be used to generate an I N condition.
* @param mixed $condition query condition or criteria. * @param mixed $condition query condition or criteria.
* @param array $params parameters to be bound to an SQL statement. * @param array $params parameters to be bound to an SQL statement.
* @return static the record found. Null if none is found. * @return static|null the record found. Null if none is found.
*/ */
public function findByAttributes($attributes,$condition='',$params=array( )) public function findByAttributes($attributes,$condition='',$params=array( ))
{ {
Yii::trace(get_class($this).'.findByAttributes()','system.db.ar.C ActiveRecord'); Yii::trace(get_class($this).'.findByAttributes()','system.db.ar.C ActiveRecord');
$prefix=$this->getTableAlias(true).'.'; $prefix=$this->getTableAlias(true).'.';
$criteria=$this->getCommandBuilder()->createColumnCriteria($this- >getTableSchema(),$attributes,$condition,$params,$prefix); $criteria=$this->getCommandBuilder()->createColumnCriteria($this- >getTableSchema(),$attributes,$condition,$params,$prefix);
return $this->query($criteria); return $this->query($criteria);
} }
/** /**
skipping to change at line 1550 skipping to change at line 1550
Yii::trace(get_class($this).'.findAllByAttributes()','system.db.a r.CActiveRecord'); Yii::trace(get_class($this).'.findAllByAttributes()','system.db.a r.CActiveRecord');
$prefix=$this->getTableAlias(true).'.'; $prefix=$this->getTableAlias(true).'.';
$criteria=$this->getCommandBuilder()->createColumnCriteria($this- >getTableSchema(),$attributes,$condition,$params,$prefix); $criteria=$this->getCommandBuilder()->createColumnCriteria($this- >getTableSchema(),$attributes,$condition,$params,$prefix);
return $this->query($criteria,true); return $this->query($criteria,true);
} }
/** /**
* Finds a single active record with the specified SQL statement. * Finds a single active record with the specified SQL statement.
* @param string $sql the SQL statement * @param string $sql the SQL statement
* @param array $params parameters to be bound to the SQL statement * @param array $params parameters to be bound to the SQL statement
* @return static the record found. Null if none is found. * @return static|null the record found. Null if none is found.
*/ */
public function findBySql($sql,$params=array()) public function findBySql($sql,$params=array())
{ {
Yii::trace(get_class($this).'.findBySql()','system.db.ar.CActiveR ecord'); Yii::trace(get_class($this).'.findBySql()','system.db.ar.CActiveR ecord');
$this->beforeFind(); $this->beforeFind();
if(($criteria=$this->getDbCriteria(false))!==null && !empty($crit eria->with)) if(($criteria=$this->getDbCriteria(false))!==null && !empty($crit eria->with))
{ {
$this->resetScope(false); $this->resetScope(false);
$finder=$this->getActiveFinder($criteria->with); $finder=$this->getActiveFinder($criteria->with);
return $finder->findBySql($sql,$params); return $finder->findBySql($sql,$params);
skipping to change at line 1852 skipping to change at line 1852
$criteria=$builder->createColumnCriteria($table,$attributes,$cond ition,$params); $criteria=$builder->createColumnCriteria($table,$attributes,$cond ition,$params);
$command=$builder->createDeleteCommand($table,$criteria); $command=$builder->createDeleteCommand($table,$criteria);
return $command->execute(); return $command->execute();
} }
/** /**
* Creates an active record with the given attributes. * Creates an active record with the given attributes.
* This method is internally used by the find methods. * This method is internally used by the find methods.
* @param array $attributes attribute values (column name=>column value) * @param array $attributes attribute values (column name=>column value)
* @param boolean $callAfterFind whether to call {@link afterFind} after the record is populated. * @param boolean $callAfterFind whether to call {@link afterFind} after the record is populated.
* @return static the newly created active record. The class of the objec t is the same as the model class. * @return static|null the newly created active record. The class of the object is the same as the model class.
* Null is returned if the input data is false. * Null is returned if the input data is false.
*/ */
public function populateRecord($attributes,$callAfterFind=true) public function populateRecord($attributes,$callAfterFind=true)
{ {
if($attributes!==false) if($attributes!==false)
{ {
$record=$this->instantiate($attributes); $record=$this->instantiate($attributes);
$record->setScenario('update'); $record->setScenario('update');
$record->init(); $record->init();
$md=$record->getMetaData(); $md=$record->getMetaData();
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)