public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = AbsencePeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setStudentId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setAcademicCalendarId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setClassGroupId($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setCode($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setTimeIn($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setTimeOut($arr[$keys[6]]); } }
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(AbsencePeer::ID, $pks, Criteria::IN); $objs = AbsencePeer::doSelect($criteria, $con); } return $objs; }
public function getAbsenceId($criteria = null, $con = null) { $c = new Criteria(); $c->add(AbsencePeer::STUDENT_ID, $this->getId()); return AbsencePeer::doSelectOne($c); }
public function executeDelete() { $attendance = AbsencePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($attendance); $ref_error = 0; foreach ($attendance->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $attendance->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('attendance/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('attendance/delete', '_ERR_DELETE_ (' . $attendance->toString() . ' - id:' . $attendance->getId() . ')'); } else { $attendance->delete(); } return $this->forward('attendance', 'list'); }