/** * @param $number * @param \Shopware\Models\Category\Category $category * @param Supplier $manufacturer * @param ProductContext $context * @return array */ protected function getProduct($number, ProductContext $context, Category $category = null, Supplier $manufacturer = null) { $product = parent::getProduct($number, $context, $category); if ($manufacturer) { $product['supplierId'] = $manufacturer->getId(); } return $product; }
/** * @param array $data * @return Models\Article\Supplier */ public function createManufacturer(array $data = array()) { $data = array_merge($this->getManufacturerData(), $data); $manufacturer = new Models\Article\Supplier(); $manufacturer->fromArray($data); $this->entityManager->persist($manufacturer); $this->entityManager->flush(); $this->createdManufacturers[] = $manufacturer->getId(); return $manufacturer; }
/** * {@inheritDoc} */ public function setManyToOne($data, $model, $property) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setManyToOne', array($data, $model, $property)); return parent::setManyToOne($data, $model, $property); }