Example #1
0
 public function executeAddPerson()
 {
     $this->forward404Unless($this->type = $this->getRequestParameter('type'));
     $this->forward404Unless($this->etime_id = $this->getRequestParameter('etime_id'));
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         $c = new Criteria();
         $c->setIgnoreCase(true);
         $c->add(PersonTypePeer::NAME, '%' . $this->getRequestParameter('type') . '%', Criteria::LIKE);
         $person_type = PersonTypePeer::doSelectOne($c);
         $this->forward404Unless($person_type);
         $etime_person = new EtimePeople();
         $etime_person->setEtimeId($this->getRequestParameter('etime_id'));
         $etime_person->setName($this->getRequestParameter('etime_person_name_' . $this->type));
         $etime_person->setEmail($this->getRequestParameter('etime_email_' . $this->type));
         $etime_person->setPhone($this->getRequestParameter('etime_phone_' . $this->type));
         $etime_person->setPersonTypeId($person_type->getId());
         $etime_person->save();
         return $this->redirect($this->getRequestParameter('referer', '@homepage'));
     }
     $this->getRequest()->getParameterHolder()->set('referer', $this->getRequest()->getReferer());
     return sfView::SUCCESS;
 }
Example #2
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = PersonTypePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setName($arr[$keys[1]]);
     }
 }
Example #3
0
 public function getPersonType($con = null)
 {
     if ($this->aPersonType === null && $this->person_type_id !== null) {
         include_once 'lib/model/om/BasePersonTypePeer.php';
         $this->aPersonType = PersonTypePeer::retrieveByPK($this->person_type_id, $con);
     }
     return $this->aPersonType;
 }
Example #4
0
 public static function doSelectJoinAllExceptEtime(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     EtimePeoplePeer::addSelectColumns($c);
     $startcol2 = EtimePeoplePeer::NUM_COLUMNS - EtimePeoplePeer::NUM_LAZY_LOAD_COLUMNS + 1;
     PersonTypePeer::addSelectColumns($c);
     $startcol3 = $startcol2 + PersonTypePeer::NUM_COLUMNS;
     $c->addJoin(EtimePeoplePeer::PERSON_TYPE_ID, PersonTypePeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = EtimePeoplePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = PersonTypePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getPersonType();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addEtimePeople($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initEtimePeoples();
             $obj2->addEtimePeople($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Example #5
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(PersonTypePeer::ID, $pks, Criteria::IN);
         $objs = PersonTypePeer::doSelect($criteria, $con);
     }
     return $objs;
 }