public function executeShow() { $student_id = $this->getContext()->getUser()->getAttribute('user_id', '', 'bo'); $this->forward404Unless($student_id); $student = StudentPeer::retrieveByPk($student_id); $this->forward404Unless($student); $c = new Criteria(); $c->add(StudentParentsPeer::STUDENT_ID, $student_id); $c->add(StudentParentsPeer::RELATION, 1); $father = StudentParentsPeer::doSelectOne($c); $count_father = StudentParentsPeer::doCount($c); #$this->forward404Unless($father); $c = new Criteria(); $c->add(StudentParentsPeer::STUDENT_ID, $student_id); $c->add(StudentParentsPeer::RELATION, 2); $mother = StudentParentsPeer::doSelectOne($c); $count_mother = StudentParentsPeer::doCount($c); #$this->forward404Unless($mother); $this->subtitle = $student->toString() . ' - id:' . $student->getId(); #$actions = array(array('name'=>'edit','url'=>'student_parents_s/edit', 'color'=>'black')); #$this->actions = $actions; $this->student = $student; $this->father = $father; $this->mother = $mother; $this->count_father = $count_father; $this->count_mother = $count_mother; }
public function countStudentParentssRelatedByRegionId($criteria = null, $distinct = false, $con = null) { include_once 'lib/model/om/BaseStudentParentsPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(StudentParentsPeer::REGION_ID, $this->getId()); return StudentParentsPeer::doCount($criteria, $distinct, $con); }