public function getParent()
 {
     $this->__load();
     return parent::getParent();
 }
 public function addStakeholder()
 {
     $data = $this->form_values;
     //  App_Controller_Functions::pr($data);
     $id = $this->checkManufacturer();
     if ($id == false) {
         $stakeholder = new Stakeholders();
         $stakeholder->setStakeholderName($data['name']);
         $type = $this->_em->getRepository("StakeholderTypes")->findOneBy(array("stakeholderTypeName" => 'Manufacturer'));
         $stakeholder->setStakeholderType($type);
         $main_stakeholder = $this->_em->getRepository("Stakeholders")->findOneBy(array("stakeholderName" => 'EPI Program'));
         $stakeholder->setMainStakeholder($main_stakeholder);
         $stakeholder_activity = $this->_em->getRepository("StakeholderActivities")->findOneBy(array("activity" => 'Routine'));
         $stakeholder->setStakeholderActivity($stakeholder_activity);
         $geo_level = $this->_em->getRepository("GeoLevels")->find("1");
         $stakeholder->setGeoLevel($geo_level);
         $stakeholder->setParent($main_stakeholder);
         $sector = $this->_em->find("StakeholderSectors", 1);
         $stakeholder->setStakeholderSector($sector);
         $this->_em->persist($stakeholder);
         $this->_em->flush();
         $id = $stakeholder->getPkId();
     }
     $check_stak_items = $this->_em->getRepository("StakeholderItemPackSizes")->findOneBy(array("stakeholder" => $id, "itemPackSize" => $data['item_id']));
     if (count($check_stak_items) == 0) {
         $stakeholder_items = new StakeholderItemPackSizes();
         $stakeholder_id = $this->_em->getRepository("Stakeholders")->find($id);
         $stakeholder_items->setStakeholder($stakeholder_id);
         $stakeholder_items->setQuantityPerPack($data['quantity']);
         $item_id = $this->_em->getRepository("ItemPackSizes")->find($data['item_id']);
         $stakeholder_items->setItemPackSize($item_id);
         $pck_id = $this->_em->getRepository("ListDetail")->find('140');
         $stakeholder_items->setPackagingLevel($pck_id);
         $this->_em->persist($stakeholder_items);
         $this->_em->flush();
     }
     return true;
 }
 public function getStakeholderType()
 {
     $this->__load();
     return parent::getStakeholderType();
 }
 public function addManufacturerAction()
 {
     $form = new Form_Iadmin_Manufacturer();
     if ($this->_request->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $stakeholder = new Stakeholders();
             $stakeholder->setStakeholderName($form->manufacturer->getValue());
             $stakeholder->setListRank('1');
             $parent_id = $this->_em->getRepository('Stakeholders')->find('1');
             $stakeholder->setParent($parent_id);
             $geo_level_id = $this->_em->getRepository('GeoLevels')->find('1');
             $stakeholder->setGeoLevel($geo_level_id);
             $stakeholder_sector = $this->_em->getRepository('StakeholderSectors')->find($form->sector->getValue());
             $stakeholder->setStakeholderSector($stakeholder_sector);
             $stakeholder_type = $this->_em->getRepository('StakeholderTypes')->find(Model_Stakeholders::TYPE_MANUFACTURER);
             $stakeholder->setStakeholderType($stakeholder_type);
             $stakeholder_activity = $this->_em->getRepository('StakeholderActivities')->find('1');
             $stakeholder->setStakeholderActivity($stakeholder_activity);
             $main_stakeholder = $this->_em->getRepository('Stakeholders')->find(1);
             $stakeholder->setMainStakeholder($main_stakeholder);
             $this->_em->persist($stakeholder);
             $this->_em->flush();
         }
     }
     $this->_redirect("/iadmin/manage-stakeholders/manufacturer");
 }