Exemplo n.º 1
0
 /**
  * @param array $data
  * @return Struct\Category
  */
 public function hydrate(array $data)
 {
     $category = new Struct\Category();
     $this->assignCategoryData($category, $data);
     if ($data['__media_id']) {
         $category->setMedia($this->mediaHydrator->hydrate($data));
     }
     if ($data['__categoryAttribute_id']) {
         $attribute = $this->extractFields('__categoryAttribute_', $data);
         $category->addAttribute('core', $this->attributeHydrator->hydrate($attribute));
     }
     return $category;
 }
Exemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function getList($ids, Struct\ShopContextInterface $context)
 {
     $query = $this->getQuery();
     $query->setParameter(':ids', $ids, Connection::PARAM_INT_ARRAY);
     /**@var $statement \Doctrine\DBAL\Driver\ResultStatement */
     $statement = $query->execute();
     $data = $statement->fetchAll(\PDO::FETCH_ASSOC);
     $result = [];
     foreach ($data as $row) {
         $mediaId = $row['__media_id'];
         $result[$mediaId] = $this->hydrator->hydrate($row);
     }
     return $result;
 }
Exemplo n.º 3
0
 /**
  * @param array $data
  * @return Struct\Property\Option
  */
 public function hydrateOption(array $data)
 {
     $option = new Struct\Property\Option();
     $translation = $this->getTranslation($data, '__propertyOption_translation', '__propertyOption_translation_fallback', ['optionValue' => '__propertyOption_value']);
     $data = array_merge($data, $translation);
     $option->setId((int) $data['__propertyOption_id']);
     $option->setName($data['__propertyOption_value']);
     $option->setPosition((int) $data['__propertyOption_position']);
     if (isset($data['__media_id']) && $data['__media_id']) {
         $option->setMedia($this->mediaHydrator->hydrate($data));
     }
     return $option;
 }