"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "framework/db/BaseActiveRecord.php" between
yii2-2.0.36.tar.gz and yii2-2.0.37.tar.gz

About: Yii 2 is a high-performance component-based PHP framework for developing large-scale Web applications (source).

BaseActiveRecord.php  (yii2-2.0.36):BaseActiveRecord.php  (yii2-2.0.37)
skipping to change at line 135 skipping to change at line 135
* This method is internally called by [[findOne()]] and [[findAll()]]. * This method is internally called by [[findOne()]] and [[findAll()]].
* @param mixed $condition please refer to [[findOne()]] for the explanation of this parameter * @param mixed $condition please refer to [[findOne()]] for the explanation of this parameter
* @return ActiveQueryInterface the newly created [[ActiveQueryInterface|Act iveQuery]] instance. * @return ActiveQueryInterface the newly created [[ActiveQueryInterface|Act iveQuery]] instance.
* @throws InvalidConfigException if there is no primary key defined * @throws InvalidConfigException if there is no primary key defined
* @internal * @internal
*/ */
protected static function findByCondition($condition) protected static function findByCondition($condition)
{ {
$query = static::find(); $query = static::find();
if (!ArrayHelper::isAssociative($condition)) { if (!ArrayHelper::isAssociative($condition) && !$condition instanceof Ex pressionInterface) {
// query by primary key // query by primary key
$primaryKey = static::primaryKey(); $primaryKey = static::primaryKey();
if (isset($primaryKey[0])) { if (isset($primaryKey[0])) {
// if condition is scalar, search for a single primary key, if i t is array, search for multiple primary key values // if condition is scalar, search for a single primary key, if i t is array, search for multiple primary key values
$condition = [$primaryKey[0] => is_array($condition) ? array_val ues($condition) : $condition]; $condition = [$primaryKey[0] => is_array($condition) ? array_val ues($condition) : $condition];
} else { } else {
throw new InvalidConfigException('"' . get_called_class() . '" m ust have a primary key.'); throw new InvalidConfigException('"' . get_called_class() . '" m ust have a primary key.');
} }
} }
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

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