public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ScoreRuleGroupPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setAcademicCalendarId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setTypeRule($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setCurriculumId($arr[$keys[3]]); } }
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(AcademicCalendarPeer::ID, ScoreRuleGroupPeer::ACADEMIC_CALENDAR_ID); $c->addJoin(DepartmentPeer::ID, AcademicCalendarPeer::DEPARTMENT_ID); $column = DepartmentPeer::getTableMap()->getColumn('ID'); } else { $column = ScoreRuleGroupPeer::getTableMap()->getColumn($key); } $name = $column->getFullyQualifiedName(); $creoleType = $column->getCreoleType(); if ($creoleType == CreoleTypes::TIMESTAMP) { $from = $value['from']; $to = $value['to']; if ($from != '' && $from != null) { $c->add($name, $from, Criteria::GREATER_EQUAL); } if ($to != '' && $to != null) { $c->add($name, $to, Criteria::LESS_EQUAL); } } else { if ($creoleType == CreoleTypes::INTEGER) { if ($name == ScoreRulePeer::CLASS_GROUP_ID) { $cg = ClassGroupPeer::retrieveByPK($value); $c->add($name, $cg->getChildRecurs(), Criteria::IN); } else { $c->add($name, $value, Criteria::EQUAL); } } else { if ($creoleType == CreoleTypes::VARCHAR || $creoleType == CreoleTypes::CHAR) { $c->add($name, "%{$value}%", Criteria::LIKE); } } } } }
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(ScoreRuleGroupPeer::ID, $pks, Criteria::IN); $objs = ScoreRuleGroupPeer::doSelect($criteria, $con); } return $objs; }