public function addItemCategoryAction() { $form = new Form_Iadmin_Products(); if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $status = '1'; // Default status is 1. $item_category = new ItemCategories(); $item_category->setItemCategoryName($form->item_category_name->getValue()); $user_id = $this->_em->getRepository('Users')->find($this->_userid); $item_category->setCreatedBy($user_id); $item_category->setModifiedBy($user_id); $item_category->setStatus($status); $item_category->setCreatedDate(App_Tools_Time::now()); $item_category->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($item_category); $this->_em->flush(); } } $this->_redirect("/iadmin/manage-products/item-categories"); }
public function setCreatedBy(\Users $createdBy) { $this->__load(); return parent::setCreatedBy($createdBy); }
public function addItemCategoryAction() { $form = new Form_Iadmin_Products(); if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $item_category = new ItemCategories(); $item_category->setItemCategoryName($form->item_category_name->getValue()); $createdBy = $this->_em->getRepository('Users')->find($this->_userid); $item_category->setCreatedBy($createdBy); $modifiedBy = $this->_em->getRepository('Users')->find($this->_userid); $item_category->setModifiedBy($modifiedBy); $this->_em->persist($item_category); $this->_em->flush(); } } $this->_redirect("/iadmin/manage-products/item-categories"); }