Пример #1
0
 public function getVInfaqsJoinClassGroup($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseVInfaqPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collVInfaqs === null) {
         if ($this->isNew()) {
             $this->collVInfaqs = array();
         } else {
             $criteria->add(VInfaqPeer::ACADEMIC_COST_ID, $this->getId());
             $this->collVInfaqs = VInfaqPeer::doSelectJoinClassGroup($criteria, $con);
         }
     } else {
         $criteria->add(VInfaqPeer::ACADEMIC_COST_ID, $this->getId());
         if (!isset($this->lastVInfaqCriteria) || !$this->lastVInfaqCriteria->equals($criteria)) {
             $this->collVInfaqs = VInfaqPeer::doSelectJoinClassGroup($criteria, $con);
         }
     }
     $this->lastVInfaqCriteria = $criteria;
     return $this->collVInfaqs;
 }
Пример #2
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = VInfaqPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setAcademicCostId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setAmount($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setCreatedAt($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setPaidAt($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setReceivable($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setAcademicCostComponentId($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setPaid($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setUpdatedAt($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setAcademicCalendarId($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setUserId($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setStudentCount($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setClassGroupId($arr[$keys[11]]);
     }
 }
Пример #3
0
 public static function doValidate(VInfaq $obj, $cols = null)
 {
     $columns = array();
     if ($cols) {
         $dbMap = Propel::getDatabaseMap(VInfaqPeer::DATABASE_NAME);
         $tableMap = $dbMap->getTable(VInfaqPeer::TABLE_NAME);
         if (!is_array($cols)) {
             $cols = array($cols);
         }
         foreach ($cols as $colName) {
             if ($tableMap->containsColumn($colName)) {
                 $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
                 $columns[$colName] = $obj->{$get}();
             }
         }
     } else {
     }
     $res = BasePeer::doValidate(VInfaqPeer::DATABASE_NAME, VInfaqPeer::TABLE_NAME, $columns);
     if ($res !== true) {
         $request = sfContext::getInstance()->getRequest();
         foreach ($res as $failed) {
             $col = VInfaqPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
             $request->setError($col, $failed->getMessage());
         }
     }
     return $res;
 }
Пример #4
0
 public function filter($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'DEPARTMENT_ID') {
             $c->addJoin(DepartmentPeer::ID, AcademicCalendarPeer::DEPARTMENT_ID);
             $c->addJoin(VInfaqPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
             $column = DepartmentPeer::getTableMap()->getColumn('ID');
         } elseif ($key == 'CLASS_NAME') {
             $c->addJoin(VInfaqPeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
             $column = ClassGroupPeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'USER_NAME') {
             $c->addJoin(VInfaqPeer::USER_ID, UserPeer::ID);
             $column = UserPeer::getTableMap()->getColumn('LOGIN');
         } else {
             $column = VInfaqPeer::getTableMap()->getColumn($key);
         }
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIMESTAMP) {
             $from = $value['from'];
             $to = $value['to'];
             $c2 = null;
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
                 $c2 = $c->getCriterion($name);
             }
             if ($from != '' && $from != null && $to != '' && $to != null) {
                 $c3 = new Criterion($c, $name, $to, Criteria::LESS_EQUAL);
                 $c2->addAnd($c3);
             }
             if (($from == '' || $from == null) && $to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::DATE) {
                 $from = $value['from'];
                 $to = $value['to'];
                 $c2 = null;
                 if ($from != '' && $from != null) {
                     $c->add($name, $from, Criteria::GREATER_EQUAL);
                     $c2 = $c->getCriterion($name);
                 }
                 if ($from != '' && $from != null && $to != '' && $to != null) {
                     $c3 = new Criterion($c, $name, $to, Criteria::LESS_EQUAL);
                     $c2->addAnd($c3);
                 }
                 if (($from == '' || $from == null) && $to != '' && $to != null) {
                     $c->add($name, $to, Criteria::LESS_EQUAL);
                 }
                 #$c->add($name, $value, Criteria::LIKE );
             } else {
                 if ($creoleType == CreoleTypes::INTEGER || $creoleType == CreoleTypes::NUMERIC || $creoleType == CreoleTypes::CHAR) {
                     $c->add($name, $value, Criteria::EQUAL);
                 } else {
                     if ($creoleType == CreoleTypes::VARCHAR) {
                         $c->add($name, "%{$value}%", Criteria::LIKE);
                     }
                 }
             }
         }
     }
 }