/**
  * {@inheritDoc}
  * @see \Owebia\AdvancedSettingCore\Model\Wrapper\AbstractWrapper::getAdditionalData()
  */
 protected function getAdditionalData()
 {
     $data = parent::getAdditionalData();
     foreach ($this->getSource()->getCollection() as $variable) {
         $data[$variable->getCode()] = $variable;
     }
     return $data;
 }
 /**
  * {@inheritDoc}
  * @see \Owebia\AdvancedSettingCore\Model\Wrapper\AbstractWrapper::loadData()
  */
 protected function loadData($key)
 {
     switch ($key) {
         case 'name':
         case 'address':
         case 'phone':
             return $this->getSource()->getConfig('general/store_information/' . $key);
     }
     return parent::loadData($key);
 }
 /**
  * {@inheritDoc}
  * @see \Owebia\ShippingCore\Model\Wrapper\AbstractWrapper::loadData()
  */
 protected function loadData($key)
 {
     switch ($key) {
         case 'options':
             $options = array();
             $helper = $this->objectManager->get('Magento\\Catalog\\Helper\\Product\\Configuration');
             $customOptions = $helper->getCustomOptions($this->getSource());
             if ($customOptions) {
                 foreach ($customOptions as $option) {
                     $options[$option['label']] = $option;
                 }
             }
             return $options;
     }
     return parent::loadData($key);
 }
 /**
  * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
  * @param \Magento\Framework\ObjectManagerInterface $objectManager
  * @param \Magento\Backend\Model\Auth\Session $backendAuthSession
  * @param \Magento\Quote\Model\Quote\Address\RateRequest $request
  * @param \Owebia\ShippingCore\Helper\Registry $registry
  * @param mixed $data
  */
 public function __construct(\Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry, \Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Backend\Model\Auth\Session $backendAuthSession, \Magento\Quote\Model\Quote\Address\RateRequest $request, \Owebia\ShippingCore\Helper\Registry $registry, $data = null)
 {
     parent::__construct($objectManager, $backendAuthSession, $request, $registry, $data);
     $this->stockRegistry = $stockRegistry;
 }
 /**
  * @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository
  * @param \Magento\Framework\ObjectManagerInterface $objectManager
  * @param \Magento\Backend\Model\Auth\Session $backendAuthSession
  * @param \Owebia\AdvancedSettingCore\Helper\Registry $registry
  * @param mixed $data
  */
 public function __construct(\Magento\Customer\Api\CustomerRepositoryInterface $customerRepository, \Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Backend\Model\Auth\Session $backendAuthSession, \Owebia\AdvancedSettingCore\Helper\Registry $registry, $data = null)
 {
     parent::__construct($objectManager, $backendAuthSession, $registry, $data);
     $this->customerRepository = $customerRepository;
 }
 /**
  * @param \Magento\Eav\Api\AttributeSetRepositoryInterface $attributeSetRespository
  * @param \Magento\Framework\ObjectManagerInterface $objectManager
  * @param \Magento\Backend\Model\Auth\Session $backendAuthSession
  * @param \Magento\Quote\Model\Quote\Address\RateRequest $request
  * @param \Owebia\ShippingCore\Helper\Registry $registry
  * @param mixed $data
  */
 public function __construct(\Magento\Eav\Api\AttributeSetRepositoryInterface $attributeSetRespository, \Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Backend\Model\Auth\Session $backendAuthSession, \Magento\Quote\Model\Quote\Address\RateRequest $request, \Owebia\ShippingCore\Helper\Registry $registry, $data = null)
 {
     parent::__construct($objectManager, $backendAuthSession, $request, $registry, $data);
     $this->attributeSetRespository = $attributeSetRespository;
 }
 /**
  * {@inheritDoc}
  * @see \Owebia\ShippingCore\Model\Wrapper\AbstractWrapper::loadData()
  */
 protected function loadData($key)
 {
     switch ($key) {
         case 'attribute_set':
             return $this->createWrapper(['id' => (int) $this->{'attribute_set_id'}], 'ProductAttributeSet');
         case 'stock_item':
             return $this->createWrapper(['product_id' => (int) $this->{'entity_id'}], 'ProductStockItem');
         case 'category_id':
             /** @var \Magento\Catalog\Api\Data\ProductInterface $product */
             $product = $this->getSource();
             return $product->getCategoryId();
         case 'category':
             /** @var \Magento\Catalog\Api\Data\ProductInterface $product */
             $product = $this->getSource();
             return $product->getCategory();
         case 'category_ids':
             /** @var \Magento\Catalog\Api\Data\ProductInterface $product */
             $product = $this->getSource();
             return $this->getSource()->getCategoryIds();
         case 'categories':
             /** @var \Magento\Catalog\Api\Data\ProductInterface $product */
             $product = $this->getSource();
             $categories = [];
             foreach ($product->getCategoryCollection() as $category) {
                 $categories[] = $category;
             }
             return $categories;
         default:
             $this->loadIfRequired($key);
             return parent::loadData($key);
     }
 }