/** * @param string $locale * @param array $filter * * @return array */ public function findAllByLocale($locale, $filter = []) { if (empty($filter)) { $items = $this->itemRepository->findAllByLocale($locale); } else { $items = $this->itemRepository->findByLocaleAndFilter($locale, $filter); } array_walk($items, function (&$item) use($locale) { $item = $this->itemFactory->createApiEntity($item, $locale); }); return $items; }
/** * @VirtualProperty * @SerializedName("items") * @Groups({"Default","cart"}) * * @return \Doctrine\Common\Collections\Collection */ public function getItems() { if (!$this->itemsChanged && $this->cacheItems && count($this->cacheItems) === count($this->entity->getItems())) { return $this->cacheItems; } else { $this->itemsChanged = false; $this->cacheItems = array(); foreach ($this->entity->getItems() as $item) { $this->cacheItems[] = $this->itemFactory->createApiEntity($item, $this->locale, $this->getCurrencyCode()); } } return $this->cacheItems; }