Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Back port the changes from 455cd9d.
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Jan 30, 2015
1 parent 09c7308 commit 6e6f957
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
7 changes: 7 additions & 0 deletions system/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Contao Open Source CMS changelog
================================

Version 3.2.18 (2015-XX-XX)
---------------------------

### Fixed
Fix an infinite recursion problem in the `FilesModel` class (see #7588).


Version 3.2.17 (2015-01-22)
---------------------------

Expand Down
20 changes: 8 additions & 12 deletions system/modules/core/library/Contao/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -780,23 +780,19 @@ public static function findMultipleByIds($arrIds, array $arrOptions=array())
*/
public static function findOneBy($strColumn, $varValue, array $arrOptions=array())
{
$intId = is_array($varValue) ? $varValue[0] : $varValue;

// Try to load from the registry
if (empty($arrOptions))
{
if (is_array($strColumn))
{
if (count($strColumn) == 1 && $strColumn[0] == static::$strPk)
{
return static::findByPk($intId, $arrOptions);
}
}
else
$arrColumn = (array) $strColumn;

if (count($arrColumn) == 1 && $arrColumn[0] == static::$strPk)
{
if ($strColumn == static::$strPk)
$intId = is_array($varValue) ? $varValue[0] : $varValue;
$objModel = \Model\Registry::getInstance()->fetch(static::$strTable, $intId);

if ($objModel !== null)
{
return static::findByPk($intId, $arrOptions);
return $objModel;
}
}
}
Expand Down

0 comments on commit 6e6f957

Please sign in to comment.