示例#1
0
 /**
  * Converts a shop doctrine model to a shop struct
  * @param \Shopware\Models\Shop\Shop $shop
  * @return Struct\Shop
  */
 public function convertShop(Models\Shop\Shop $shop)
 {
     $struct = new Struct\Shop();
     $struct->setId($shop->getId());
     $struct->setName($shop->getName());
     $struct->setHost($shop->getHost());
     $struct->setPath($shop->getBasePath());
     $struct->setUrl($shop->getBaseUrl());
     $struct->setSecure($shop->getSecure());
     $struct->setSecureHost($shop->getSecureHost());
     $struct->setSecurePath($struct->getSecurePath());
     if ($shop->getCategory()) {
         $struct->setCategory($this->convertCategory($shop->getCategory()));
     }
     return $struct;
 }
 /**
  * @param Shop $shop
  * @param Criteria $criteria
  * @return int
  */
 private function getActiveCategoryId(Shop $shop, Criteria $criteria)
 {
     /**@var $condition CategoryCondition*/
     $category = $shop->getCategory()->getId();
     if ($condition = $criteria->getCondition('category')) {
         $category = $condition->getCategoryIds()[0];
     }
     return $category;
 }
示例#3
0
 /**
  * @param ShopEntity $shop
  * @return Shop
  */
 public static function createFromShopEntity(ShopEntity $shop)
 {
     $struct = new self();
     $struct->setId($shop->getId());
     $struct->setParentId($shop->getMain() ? $shop->getMain()->getId() : $shop->getId());
     $struct->setIsDefault($shop->getDefault());
     $struct->setName($shop->getName());
     $struct->setHost($shop->getHost());
     $struct->setPath($shop->getBasePath());
     $struct->setUrl($shop->getBaseUrl());
     $struct->setSecure($shop->getSecure());
     $struct->setSecureHost($shop->getSecureHost());
     $struct->setSecurePath($shop->getSecureBasePath());
     if ($shop->getCategory()) {
         $struct->setCategory(Category::createFromCategoryEntity($shop->getCategory()));
     }
     if ($shop->getFallback()) {
         $struct->setFallbackId($shop->getFallback()->getId());
     }
     return $struct;
 }