Exemplo n.º 1
0
 public function addFacilityLocation(FacilityLocation $l)
 {
     $this->collFacilityLocations[] = $l;
     $l->setFacility($this);
 }
Exemplo n.º 2
0
 public function executeUpdateFacilityShow()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     if ($action_type == $action_i18n || !$this->getRequestParameter('facility_location_id')) {
         $facility_location = new FacilityLocation();
         $facility_location->setLocationId($this->getRequestParameter('location_id'));
         $facility_location->setFacilityId($this->getRequestParameter('facility_id'));
         $facility_location->setTotal($this->getRequestParameter('total'));
         $facility_location->setStatus($this->getRequestParameter('status'));
         $facility_location->save();
         return $this->redirect('location/show?id=' . $this->getRequestParameter('location_id'));
     } else {
         #$facility_location = FacilityLocationPeer::retrieveByPk($this->getRequestParameter('facility_location_id'));
         #$this->forward404Unless($facility_location);
         $c = new Criteria();
         $c->add(FacilityLocationPeer::ID, $this->getRequestParameter('facility_location_id'));
         $facility_location = FacilityLocationPeer::doSelectOne($c);
         $facility_location->setId($this->getRequestParameter('facility_location_id'));
         $facility_location->setLocationId($this->getRequestParameter('location_id'));
         $facility_location->setFacilityId($this->getRequestParameter('facility_id'));
         $facility_location->setTotal($this->getRequestParameter('total'));
         $facility_location->setStatus($this->getRequestParameter('status'));
         $facility_location->save();
         return $this->redirect('location/show?id=' . $this->getRequestParameter('location_id'));
     }
 }