public function setItem(\Items $item) { $this->__load(); return parent::setItem($item); }
public function addProductAction() { $form = new Form_Iadmin_Products(); if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $item_pack_size = new ItemPackSizes(); $item_pack_size->setItemName($form->item_name->getValue()); $item_pack_size->setDescription($form->description->getValue()); $item_pack_size->setListRank($form->list_rank->getValue()); $item_unit = $this->_em->getRepository('ItemUnits')->find($form->item_unit->getValue()); $item_pack_size->setItemUnit($item_unit); $items = $this->_em->getRepository('Items')->find($form->item->getValue()); $item_pack_size->setItem($items); $item_category = $this->_em->getRepository('ItemCategories')->find($form->item_category->getValue()); $item_pack_size->setItemCategory($item_category); if ($form->item_category->getValue() == '1') { $item_pack_size->setNumberOfDoses($form->number_of_doses->getValue()); } $created_by = $this->_em->find('Users', $this->_user_id); $item_pack_size->setCreatedBy($created_by); $item_pack_size->setCreatedDate(App_Tools_Time::now()); $item_pack_size->setModifiedBy($created_by); $item_pack_size->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($item_pack_size); $this->_em->flush(); } } $this->_redirect("/iadmin/manage-products/products"); }