Exemplo n.º 1
0
 public function create(array $data)
 {
     $ent = new Product();
     $cat = $this->_em->getReference(C::REPO_PRODUCT_CATEGORY, $data[C::FORM_CATEGORY]);
     $ent->setActive(true)->setCategory($cat)->setName($data[C::FORM_TITLE]);
     $this->_em->persist($ent);
     $this->_em->flush($ent);
 }
Exemplo n.º 2
0
 public function createAttributeMap(Product $product, $attributeId)
 {
     $this->productsAttrMapRepo->failOnExists(['product' => $product->getId(), 'attribute' => $attributeId]);
     $ent = new ProductAttributeMap();
     $attribute = $this->em->getReference(C::REPO_PRODUCT_ATTR, $attributeId);
     $ent->setProduct($product)->setAttribute($attribute);
     $this->em->persist($ent);
     $this->em->flush($ent);
     return $ent;
 }