"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "framework/db/ActiveRecord.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).

ActiveRecord.php  (yii2-2.0.36):ActiveRecord.php  (yii2-2.0.37)
skipping to change at line 175 skipping to change at line 175
* 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])) {
$pk = $primaryKey[0]; $pk = $primaryKey[0];
if (!empty($query->join) || !empty($query->joinWith)) { if (!empty($query->join) || !empty($query->joinWith)) {
$pk = static::tableName() . '.' . $pk; $pk = static::tableName() . '.' . $pk;
} }
// 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 = [$pk => is_array($condition) ? array_values($condit ion) : $condition]; $condition = [$pk => is_array($condition) ? array_values($condit ion) : $condition];
} else { } else {
 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)