Ejemplo n.º 1
0
 /**
  * @param string $attributeType
  *
  * @throws \Spryker\Zed\Product\Business\Exception\MissingAttributeTypeException
  *
  * @return \Orm\Zed\Product\Persistence\SpyProductAttributeType
  */
 protected function getAttributeType($attributeType)
 {
     $attributeTypeQuery = $this->productQueryContainer->queryAttributeTypeByName($attributeType);
     $attributeType = $attributeTypeQuery->findOne();
     if (!$attributeType) {
         throw new MissingAttributeTypeException(sprintf('Tried to retrieve a missing attribute type: %s', $attributeType));
     }
     return $attributeType;
 }
Ejemplo n.º 2
0
 /**
  * @param string $abstractSku
  *
  * @return \Generated\Shared\Transfer\ProductVariantTransfer[]
  */
 public function getProductVariantsByAbstractSku($abstractSku)
 {
     $abstractProduct = $this->productQueryContainer->queryProductAbstractBySku($abstractSku)->findOne();
     if (!$abstractProduct) {
         return [];
     }
     $abstractProductVariants = $this->createAbstractProductVariants($abstractProduct);
     $productVariants = $this->createConcreteProductVariants($abstractProduct, $abstractProductVariants);
     return $productVariants;
 }
Ejemplo n.º 3
0
 /**
  * @param string $sku
  *
  * @throws \Spryker\Zed\Product\Business\Exception\MissingProductException
  *
  * @return string
  */
 public function getAbstractSkuFromProductConcrete($sku)
 {
     $productConcrete = $this->productQueryContainer->queryProductConcreteBySku($sku)->findOne();
     if (!$productConcrete) {
         throw new MissingProductException(sprintf('Tried to retrieve a product concrete with sku %s, but it does not exist.', $sku));
     }
     return $productConcrete->getSpyProductAbstract()->getSku();
 }