protected function addProduct($name, $description, $color = null, $size = null, $altKey = null, $seller = null, $parent = null) { if (($product = $this->isProductExist($name)) === false) { $product = new Entity\Product(); } $product->setName($name); $product->setDescription($description); $product->setCustomer($this->_customer); $product->setCustomText1($color); $product->setCustomText2($size); $product->setCustomText3($altKey); $product->setCustomText4($seller); $product->setParent($parent); $this->_em->persist($product); return $product; }