Working : Content : fix loop giving no elements

This commit is contained in:
gmorel
2013-09-17 17:43:19 +02:00
parent 9c0d310441
commit c99e7a91b9

View File

@@ -102,15 +102,16 @@ class Content extends BaseI18nLoop
if (!is_null($folder) || !is_null($folderDefault)) {
$folders = array();
if (!is_null($folder)) {
$folders = array_merge($folders, FolderQuery::create()->filterById($folder, Criteria::IN)->find());
}
if (!is_null($folderDefault)) {
$folders = array_merge(FolderQuery::create()->filterById($folderDefault, Criteria::IN)->find());
$foldersIds = array();
if (!is_array($folder)) {
$folder = array();
}
if (!is_array($folderDefault)) {
$folderDefault = array();
}
$foldersIds = array_merge($foldersIds, $folder, $folderDefault);
$folders =FolderQuery::create()->filterById($foldersIds, Criteria::IN)->find();
$depth = $this->getDepth();
@@ -175,12 +176,12 @@ class Content extends BaseI18nLoop
$search->addDescendingOrderByColumn('i18n_TITLE');
break;
case "manual":
if(null === $folder || count($folder) != 1)
if(null === $foldersIds || count($foldersIds) != 1)
throw new \InvalidArgumentException('Manual order cannot be set without single folder argument');
$search->orderByPosition(Criteria::ASC);
break;
case "manual_reverse":
if(null === $folder || count($folder) != 1)
if(null === $foldersIds || count($foldersIds) != 1)
throw new \InvalidArgumentException('Manual order cannot be set without single folder argument');
$search->orderByPosition(Criteria::DESC);
break;