public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = StudentPersonalityPeer::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->setPersonalityId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setGrade($arr[$keys[3]]); } }
public function executeDelete() { $student_personality = StudentPersonalityPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student_personality); $ref_error = 0; foreach ($student_personality->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $student_personality->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('student_personality/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('student_personality/delete', '_ERR_DELETE_ (' . $student_personality->toString() . ' - id:' . $student_personality->getId() . ')'); } else { $student_personality->delete(); } return $this->forward('student_personality', 'list'); }
public function getStudentPersonalitysJoinStudent($criteria = null, $con = null) { include_once 'lib/model/om/BaseStudentPersonalityPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collStudentPersonalitys === null) { if ($this->isNew()) { $this->collStudentPersonalitys = array(); } else { $criteria->add(StudentPersonalityPeer::PERSONALITY_ID, $this->getId()); $this->collStudentPersonalitys = StudentPersonalityPeer::doSelectJoinStudent($criteria, $con); } } else { $criteria->add(StudentPersonalityPeer::PERSONALITY_ID, $this->getId()); if (!isset($this->lastStudentPersonalityCriteria) || !$this->lastStudentPersonalityCriteria->equals($criteria)) { $this->collStudentPersonalitys = StudentPersonalityPeer::doSelectJoinStudent($criteria, $con); } } $this->lastStudentPersonalityCriteria = $criteria; return $this->collStudentPersonalitys; }
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(StudentPersonalityPeer::ID, $pks, Criteria::IN); $objs = StudentPersonalityPeer::doSelect($criteria, $con); } return $objs; }