diff --git a/library/Class/PanierNotice.php b/library/Class/PanierNotice.php index 267a54fb9c99c4fcbb43be436a2e82a1c71badda..8171d695f3ab6b9362d134919d630ef6cdbffbcf 100644 --- a/library/Class/PanierNotice.php +++ b/library/Class/PanierNotice.php @@ -48,22 +48,25 @@ class PanierNoticeLoader extends Storm_Model_Loader { public function findAllIdsWithCatalogue() { - return array_filter( - array_unique( - array_map( - function($association) {return $association->getIdPanier();}, - Class_PanierNoticeCatalogue::findAll()))); + $panier_notice_catalogue = Class_PanierNoticeCatalogue::getLoader()->findAll(); + $ids_with_catalogue = array_map(function($association) {return $association->getIdPanier();}, $panier_notice_catalogue); + return array_filter(array_unique($ids_with_catalogue)); } public function findAllWithCatalogue() { - return Class_PanierNotice::findAllBy(['id' => $this->findAllIdsWithCatalogue()]); + $ids = $this->findAllIdsWithCatalogue(); + + if(empty($ids)) + return []; + + return Class_PanierNotice::findAllBy(['id' => $ids]); } public function indexAll() { Class_NoticeDomain::deleteBy(['panier_id not' => 0]); - $cart_to_index = Class_PanierNotice::findAllWithCatalogue(); + $cart_to_index = Class_PanierNotice::getLoader()->findAllWithCatalogue(); foreach($cart_to_index as $cart) { $cart->index(); }