/**
  * I am the constructor
  *
  * @param PlentySoapObject_ItemCategoryTreeNode|PlentySoapObject_ItemCategory $categoryNode
  * @param integer $storeId
  * @throws Exception
  */
 public function __construct($categoryNode, $storeId, $categoryNodeLang = 'de')
 {
     $category = array();
     if (property_exists($categoryNode, 'ItemCategoryPath')) {
         $categoryPath = explode(';', $categoryNode->ItemCategoryPath);
         $categoryPathNames = explode(';', $categoryNode->ItemCategoryPathNames);
     } else {
         if (property_exists($categoryNode, 'CategoryPath')) {
             $categoryPath = explode(';', $categoryNode->CategoryPath);
             $categoryPathNames = explode(';', $categoryNode->CategoryPathNames);
         } else {
             throw new Exception();
         }
     }
     foreach ($categoryPath as $n => $categoryId) {
         if ($categoryId == 0) {
             break;
         }
         $category[] = array('branchId' => $categoryId, 'name' => $categoryPathNames[$n]);
     }
     $this->plentyCategoryBranch = $category;
     $this->storeId = $storeId;
     $this->shopId = PlentymarketsMappingController::getShopByPlentyID($storeId);
     $this->categoryNodeLang = $categoryNodeLang;
     // get the main language of the shop set it temp
     $mainLang = array_values(PlentymarketsTranslation::getShopMainLanguage($this->shopId));
     $this->shopLang = PlentymarketsTranslation::getPlentyLocaleFormat($mainLang[0]['locale']);
     if (is_null(self::$CategoryRepository)) {
         self::$CategoryRepository = Shopware()->Models()->getRepository('Shopware\\Models\\Category\\Category');
     }
     if (is_null(self::$CategoryApi)) {
         self::$CategoryApi = Shopware\Components\Api\Manager::getResource('Category');
     }
 }
 /**
  * I am the constructor
  *
  * @param PlentySoapObject_ItemCategoryTreeNode|PlentySoapObject_ItemCategory $categoryNode
  * @param integer $storeId
  * @throws Exception
  */
 public function __construct($categoryNode, $storeId)
 {
     $category = array();
     if (property_exists($categoryNode, 'ItemCategoryPath')) {
         $categoryPath = explode(';', $categoryNode->ItemCategoryPath);
         $categoryPathNames = explode(';', $categoryNode->ItemCategoryPathNames);
     } else {
         if (property_exists($categoryNode, 'CategoryPath')) {
             $categoryPath = explode(';', $categoryNode->CategoryPath);
             $categoryPathNames = explode(';', $categoryNode->CategoryPathNames);
         } else {
             throw new Exception();
         }
     }
     foreach ($categoryPath as $n => $categoryId) {
         if ($categoryId == 0) {
             break;
         }
         $category[] = array('branchId' => $categoryId, 'name' => $categoryPathNames[$n]);
     }
     $this->plentyCategoryBranch = $category;
     $this->storeId = $storeId;
     $this->shopId = PlentymarketsMappingController::getShopByPlentyID($storeId);
     if (is_null(self::$CategoryRepository)) {
         self::$CategoryRepository = Shopware()->Models()->getRepository('Shopware\\Models\\Category\\Category');
     }
     if (is_null(self::$CategoryApi)) {
         self::$CategoryApi = Shopware\Components\Api\Manager::getResource('Category');
     }
 }