public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = VEmployeeAbsencePeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setAcademicCalendarId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setTotalAbsence($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setDate($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setId($arr[$keys[3]]); } }
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(VEmployeeAbsencePeer::ID, $pks, Criteria::IN); $objs = VEmployeeAbsencePeer::doSelect($criteria, $con); } return $objs; }
public function filter($c, $filters) { $filters_key = array_keys($filters); foreach ($filters_key as $key) { $value = $filters[$key]; if ($value == '' || $value == null) { continue; } $column = VEmployeeAbsencePeer::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); } } elseif ($creoleType == CreoleTypes::DATE) { #$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); $c->add($name, $value, Criteria::EQUAL); } else { if ($creoleType == CreoleTypes::INTEGER) { $c->add($name, $value, Criteria::EQUAL); } else { if ($creoleType == CreoleTypes::VARCHAR || $creoleType == CreoleTypes::CHAR) { $c->add($name, "%{$value}%", Criteria::LIKE); } } } } }