Пример #1
0
 /**
  * Adds the data from the given object to the item
  *
  * @param \Aimeos\MShop\Common\Manager\Iface $manager Manager object
  * @param \Aimeos\MShop\Common\Item\Iface $item Item object to add the data to
  * @param \stdClass $data Object with "attributes" property
  * @param string $domain Domain of the type item
  * @return \Aimeos\MShop\Common\Item\Iface Item including the data
  */
 protected function addItemData(\Aimeos\MShop\Common\Manager\Iface $manager, \Aimeos\MShop\Common\Item\Iface $item, \stdClass $data, $domain)
 {
     if (isset($data->attributes)) {
         $attr = (array) $data->attributes;
         $key = str_replace('/', '.', $item->getResourceType());
         if (isset($attr[$key . '.type'])) {
             $typeItem = $manager->getSubManager('type')->findItem($attr[$key . '.type'], array(), $domain);
             $attr[$key . '.typeid'] = $typeItem->getId();
         }
         $item->fromArray($attr);
     }
     return $item;
 }