예제 #1
0
 /**
  * @param \Generated\Shared\Transfer\ProductAbstractTransfer $product
  *
  * @return bool
  */
 public function writeProductAbstract(ProductAbstractTransfer $product)
 {
     $this->productStatement->execute([':sku' => $product->getSku(), ':attributes' => json_encode($product->getAttributes())]);
     foreach ($product->getLocalizedAttributes() as $localizedAttributes) {
         $this->attributesStatement->execute([':attributes' => json_encode($localizedAttributes->getAttributes()), ':name' => $localizedAttributes->getName(), ':productAbstractSku' => $product->getSku(), ':fkLocale' => $this->localeTransfer->getIdLocale()]);
     }
     return true;
 }
예제 #2
0
 /**
  * @param \Generated\Shared\Transfer\ProductAbstractTransfer $productAbstractTransfer
  *
  * @return int
  */
 public function createProductAbstract(ProductAbstractTransfer $productAbstractTransfer)
 {
     $sku = $productAbstractTransfer->getSku();
     $encodedAttributes = $this->encodeAttributes($productAbstractTransfer->getAttributes());
     $productAbstract = new SpyProductAbstract();
     $productAbstract->setAttributes($encodedAttributes)->setSku($sku);
     $productAbstract->save();
     $idProductAbstract = $productAbstract->getPrimaryKey();
     $productAbstractTransfer->setIdProductAbstract($idProductAbstract);
     $this->createProductAbstractAttributes($productAbstractTransfer);
     $this->createProductAbstractImages($productAbstractTransfer);
     return $idProductAbstract;
 }