本文整理匯總了PHP中sfPropelPager::getLastPage方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfPropelPager::getLastPage方法的具體用法?PHP sfPropelPager::getLastPage怎麽用?PHP sfPropelPager::getLastPage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfPropelPager
的用法示例。
在下文中一共展示了sfPropelPager::getLastPage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createLastYearDivisions
public function createLastYearDivisions()
{
$last_year_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($this->getSchoolYear());
$last_year_career_school_year = CareerSchoolYearPeer::retrieveByCareerAndSchoolYear($this->getCareer(), $last_year_school_year);
SchoolYearPeer::clearInstancePool();
CareerSchoolYearPeer::clearInstancePool();
$con = Propel::getConnection();
try {
$con->beginTransaction();
$criteria = new Criteria();
$criteria->add(DivisionPeer::CAREER_SCHOOL_YEAR_ID, $last_year_career_school_year->getId());
$pager = new sfPropelPager('Division', 10);
$pager->setCriteria($criteria);
$pager->init();
$last_page = $pager->getLastPage();
for ($i = 1; $i <= $last_page; $i++) {
$pager->setPage($i);
$pager->init();
$divisions = $pager->getResults();
//This creates all the divisions, courses and courses subjects of the last year.
foreach ($divisions as $division) {
$division->createCopyForSchoolYear($con, $this);
$division->clearAllReferences(true);
unset($division);
}
DivisionPeer::clearInstancePool();
}
unset($criteria);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
示例2: closeSchoolYear
/**
* This method check if the students pass the year or not
*
* @param SchoolYear $school_year
* @param PropelPDO $con
*/
public function closeSchoolYear(SchoolYear $school_year, PropelPDO $con = null)
{
$criteria = SchoolYearStudentPeer::retrieveStudentsForSchoolYearCriteria($school_year);
$pager = new sfPropelPager('Student', 100);
$pager->setCriteria($criteria);
$pager->init();
$last_page = $pager->getLastPage();
for ($i = 1; $i <= $last_page; $i++) {
$pager->setPage($i);
$pager->init();
$students = $pager->getResults();
foreach ($students as $student) {
if ($student->getLastStudentCareerSchoolYear()->getStatus() != StudentCareerSchoolYearStatus::WITHDRAWN_WITH_RESERVE) {
$this->stepToNextYear($student, $school_year, $con);
}
}
$school_year->setIsClosed(true);
$school_year->save($con);
StudentPeer::clearInstancePool();
}
}