/** * Stores an eventual product image. * * @return Entity */ protected function storeEntity() { // Store the product. $product = parent::storeEntity(); // Store the image, if there's one. $picturePostedData = $this->getRequest()->getParameter('picture'); if ($picturePostedData) { if ($this->storeImage($product->getId(), @$picturePostedData['tmp_name'])) { // Store the updated product. $product->store(); } } return $product; }