private function saveProduc($producData)
 {
     $newProduct = new Product();
     $newProduct->setTitle($producData['title']);
     $newProduct->setDescription($producData['description']);
     $newProduct->setPrice($producData['price']);
     $newProduct->setInit($producData['init']);
     $newProduct->setExpiry($producData['expiry']);
     $newProduct->setAddress($producData['address']);
     $newProduct->setName($producData['name']);
     $newProduct->setTextorigin($producData['textOrigiin']);
     $em = $this->getDoctrine()->getManager();
     $em->persist($newProduct);
     $em->flush();
     return true;
 }
 public function loadProduct()
 {
     foreach ($this->loadRaw('Product') as $key => $data) {
         $entity = new Product();
         $entity->setName($data['name']);
         $entity->setUser($this->getReference($data['user']));
         foreach ($data['likers'] as $user) {
             $entity->addLiker($this->getReference($user));
         }
         $this->addReference($key, $entity);
         $this->manager->persist($entity);
     }
 }
 public function addLikedProduct(Product $product)
 {
     $product->addLiker($this);
     $this->likedProducts[] = $product;
 }
 /**
  * {@inheritDoc}
  */
 public function getCategory()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getCategory', array());
     return parent::getCategory();
 }