diff --git a/core/lib/Thelia/Action/Cache.php b/core/lib/Thelia/Action/Cache.php index 10a70f2f2..85cedadd8 100644 --- a/core/lib/Thelia/Action/Cache.php +++ b/core/lib/Thelia/Action/Cache.php @@ -39,10 +39,8 @@ class Cache extends BaseAction implements EventSubscriberInterface { $dir = $event->getDir(); - $directoryBrowser = new \DirectoryIterator($dir); - $fs = new Filesystem(); - $fs->remove($directoryBrowser); + $fs->remove($dir); } diff --git a/core/lib/Thelia/Core/Template/Element/BaseLoop.php b/core/lib/Thelia/Core/Template/Element/BaseLoop.php index d08e3a741..bbeb57e45 100644 --- a/core/lib/Thelia/Core/Template/Element/BaseLoop.php +++ b/core/lib/Thelia/Core/Template/Element/BaseLoop.php @@ -337,7 +337,7 @@ abstract class BaseLoop * @param $pagination * @return LoopResult */ - public function exec(&$pagination) + public function exec(&$pagination, $count = false) { if ($this instanceof PropelSearchLoopInterface) { $searchModelCriteria = $this->buildModelCriteria(); @@ -361,6 +361,10 @@ abstract class BaseLoop } } + if ($count) { + return $results ? count($results) : 0; + } + $loopResult = new LoopResult($results); if (true === $this->countable) { diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php index f7b6fc559..64bce76d3 100644 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php @@ -91,9 +91,7 @@ class TheliaLoop extends AbstractSmartyPlugin $dummy = null; - $loopResults = $loop->exec($dummy); - - return $loopResults->valid() ? $loopResults->getCount() : 0; + return $loop->exec($dummy, true); } /** diff --git a/install/faker.php b/install/faker.php index 53a0e477c..4d2cc3c85 100644 --- a/install/faker.php +++ b/install/faker.php @@ -367,18 +367,18 @@ try { //categories and products $productIdList = array(); $categoryIdList = array(); - for ($i=1; $i<5; $i++) { + for ($i=1; $i<20; $i++) { $category = createCategory($faker, 0, $i, $categoryIdList, $contentIdList); - for ($j=1; $jgetId(), $j, $categoryIdList, $contentIdList); - for ($k=0; $k