Пример #1
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(ActivityTypePeer::ID, $pks, Criteria::IN);
         $objs = ActivityTypePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Пример #2
0
 public function getActivityType($con = null)
 {
     include_once 'lib/model/om/BaseActivityTypePeer.php';
     if ($this->aActivityType === null && $this->activity_type_id !== null) {
         $this->aActivityType = ActivityTypePeer::retrieveByPK($this->activity_type_id, $con);
     }
     return $this->aActivityType;
 }
Пример #3
0
 public function executeDelete()
 {
     $activity_type = ActivityTypePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($activity_type);
     $ref_error = 0;
     foreach ($activity_type->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $activity_type->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('activity_type/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('activity_type/delete', '_ERR_DELETE_ (' . $activity_type->toString() . ' - id:' . $activity_type->getId() . ')');
     } else {
         $activity_type->delete();
     }
     return $this->forward('activity_type', 'list');
 }
Пример #4
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ActivityTypePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setCode($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setName($arr[$keys[2]]);
     }
 }
Пример #5
0
 public static function doSelectJoinAllExceptAcademicCalendar(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     AccalActivityPeer::addSelectColumns($c);
     $startcol2 = AccalActivityPeer::NUM_COLUMNS - AccalActivityPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     ActivityTypePeer::addSelectColumns($c);
     $startcol3 = $startcol2 + ActivityTypePeer::NUM_COLUMNS;
     $c->addJoin(AccalActivityPeer::ACTIVITY_TYPE_ID, ActivityTypePeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = AccalActivityPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = ActivityTypePeer::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->getActivityType();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addAccalActivity($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initAccalActivitys();
             $obj2->addAccalActivity($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }