示例#1
0
 /**
  * Declares an association between this object and a PassengerIllnessCategory object.
  *
  * @param      PassengerIllnessCategory $v
  * @return     Passenger The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setPassengerIllnessCategory(PassengerIllnessCategory $v = null)
 {
     if ($v === null) {
         $this->setPassengerIllnessCategoryId(NULL);
     } else {
         $this->setPassengerIllnessCategoryId($v->getId());
     }
     $this->aPassengerIllnessCategory = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the PassengerIllnessCategory object, it will not be re-added.
     if ($v !== null) {
         $v->addPassenger($this);
     }
     return $this;
 }
示例#2
0
 /**
  * Add or edit Passenger illness
  * CODE: passenger_illness_create
  */
 public function executeUpdateIllness(sfWebRequest $request)
 {
     # security
     if (!$this->getUser()->hasCredential(array('Administrator'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
         $this->redirect('dashboard/index');
     }
     if ($request->getParameter('id')) {
         $ill = PassengerIllnessCategoryPeer::retrieveByPK($request->getParameter('id'));
         $this->forward404Unless($ill);
         $this->title = 'Edit passenger illness category';
         $success = 'Passenger Illness Category  has been successfully changed!';
     } else {
         $ill = new PassengerIllnessCategory();
         $this->title = 'Add new passenger illness category';
         $success = 'Passenger Illness Category  has been successfully created!';
     }
     $this->form = new PassengerIllnessCategoryForm($ill);
     if ($request->isMethod('post')) {
         $this->referer = $request->getParameter('referer');
         $this->form->bind($request->getParameter('pill'));
         if ($this->form->isValid()) {
             $ill->setCategoryDescription($this->form->getValue('category_description'));
             $ill->setSuperCategoryDescription($this->form->getValue('super_category_description'));
             $ill->save();
             $this->getUser()->setFlash('success', $success);
             $this->redirect('@pill');
         }
     } else {
         # Set referer URL
         $this->referer = $request->getReferer() ? $request->getReferer() : '@pill';
     }
     $this->ill = $ill;
 }
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      PassengerIllnessCategory $value A PassengerIllnessCategory object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(PassengerIllnessCategory $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }