public function addAction()
 {
     $form = new Form_Iadmin_Resources();
     if ($this->_request->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $resource = new Resources();
             $resource->setResourceName($form->resource_name->getValue());
             $resource->setDescription($form->description->getValue());
             $resource_type = $this->_em->find('ResourceTypes', $form->resource_type->getValue());
             $resource->setResourceType($resource_type);
             $parent_val = $form->parent_id->getValue();
             $parent_id = !empty($parent_val) ? $parent_val : 0;
             $resource->setParentId($parent_id);
             $resource->setRank($form->rank->getValue());
             $resource->setLevel($form->level->getValue());
             $resource->setPageTitle($form->page_title->getValue());
             $resource->setMetaTitle($form->meta_title->getValue());
             $resource->setMetaDescription($form->meta_desc->getValue());
             $user_id = $this->_em->find('Users', $this->_userid);
             $resource->setCreatedBy($user_id);
             $resource->setModifiedBy($user_id);
             $resource->setCreatedDate(new \DateTime(date("Y-m-d")));
             $this->_em->persist($resource);
             $this->_em->flush();
         }
     }
     $this->_redirect("/iadmin/manage-resources");
 }
Exemplo n.º 2
0
 public function setResourceType(\ResourceTypes $resourceType)
 {
     $this->__load();
     return parent::setResourceType($resourceType);
 }