本文整理汇总了PHP中PersonPeer::alias方法的典型用法代码示例。如果您正苦于以下问题:PHP PersonPeer::alias方法的具体用法?PHP PersonPeer::alias怎么用?PHP PersonPeer::alias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PersonPeer
的用法示例。
在下文中一共展示了PersonPeer::alias方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPager
public static function getPager($max = 10, $page = 1, $date_req = null, $pass_name = null, $req_name = null, $pass_lname = null, $req_lname = null)
{
$c = new Criteria();
$c->addJoin(self::PASSENGER_ID, PassengerPeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(self::REQUESTER_ID, RequesterPeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(PassengerPeer::PERSON_ID, PersonPeer::alias('c1', PersonPeer::ID), Criteria::LEFT_JOIN);
$c->addJoin(RequesterPeer::PERSON_ID, PersonPeer::alias('c2', PersonPeer::ID), Criteria::LEFT_JOIN);
$c->addAlias('c1', PersonPeer::TABLE_NAME);
$c->addAlias('c2', PersonPeer::TABLE_NAME);
if ($date_req) {
$c->add(self::DATE_REQUESTED, '%' . date('Y-m-d', strtotime($date_req)) . '%', Criteria::LIKE);
}
if ($pass_name) {
$c->add(PersonPeer::alias("c1", PersonPeer::FIRST_NAME), $pass_name . '%', Criteria::LIKE);
}
if ($req_name) {
$c->add(PersonPeer::alias("c2", PersonPeer::FIRST_NAME), $req_name . '%', Criteria::LIKE);
}
if ($pass_lname) {
$c->add(PersonPeer::alias("c1", PersonPeer::LAST_NAME), $pass_lname . '%', Criteria::LIKE);
}
if ($req_lname) {
$c->add(PersonPeer::alias("c2", PersonPeer::LAST_NAME), $req_lname . '%', Criteria::LIKE);
}
$c->addAscendingOrderByColumn(self::DATE_REQUESTED);
$pager = new sfPropelPager('Itinerary', $max);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例2: getPager
public static function getPager($max = 10, $page = 1, $miss_ext_id = null, $miss_type = null, $miss_date1 = null, $miss_date2 = null, $pass_fname = null, $pass_lname = null, $mreq_fname = null, $mreq_lname = null)
{
$c = new Criteria();
$c->addJoin(self::MISSION_TYPE_ID, MissionTypePeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(self::REQUESTER_ID, RequesterPeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(self::PASSENGER_ID, PassengerPeer::ID, Criteria::LEFT_JOIN);
//person
$c->addJoin(PassengerPeer::PERSON_ID, PersonPeer::alias('p1', PersonPeer::ID), Criteria::LEFT_JOIN);
$c->addJoin(RequesterPeer::PERSON_ID, PersonPeer::alias('p2', PersonPeer::ID), Criteria::LEFT_JOIN);
$c->addAlias('p1', PersonPeer::TABLE_NAME);
$c->addAlias('p2', PersonPeer::TABLE_NAME);
if ($miss_ext_id) {
$c->add(self::EXTERNAL_ID, $miss_ext_id);
}
if ($miss_type) {
$c->add(MissionTypePeer::NAME, $miss_type . '%', Criteria::LIKE);
}
if ($miss_date1 != null && $miss_date2 != null) {
$criterion = $c->getNewCriterion(self::MISSION_DATE, date('Y-m-d', strtotime($miss_date1)) . ' 00:00:00', Criteria::GREATER_EQUAL);
$criterion->addAnd($c->getNewCriterion(self::MISSION_DATE, date('Y-m-d', strtotime($miss_date2)) . ' 00:00:00', Criteria::LESS_EQUAL));
$c->add($criterion);
} elseif ($miss_date1) {
$c->add(self::MISSION_DATE, date('Y-m-d', strtotime($miss_date1)) . ' 00:00:00', Criteria::GREATER_EQUAL);
} elseif ($miss_date2) {
$c->add(self::MISSION_DATE, date('Y-m-d', strtotime($miss_date2)) . ' 00:00:00', Criteria::LESS_EQUAL);
}
if ($pass_fname) {
$c->add(PersonPeer::alias("p1", PersonPeer::FIRST_NAME), $pass_fname . '%', Criteria::LIKE);
}
if ($pass_lname) {
$c->add(PersonPeer::alias("p1", PersonPeer::LAST_NAME), $pass_lname . '%', Criteria::LIKE);
}
if ($mreq_fname) {
$c->add(PersonPeer::alias("p2", PersonPeer::FIRST_NAME), $mreq_fname . '%', Criteria::LIKE);
}
if ($mreq_lname) {
$c->add(PersonPeer::alias("p2", PersonPeer::LAST_NAME), $mreq_lname . '%', Criteria::LIKE);
}
// $sort_date = time();
// $mis = self::MISSION_DATE;
// echo $mis;die;
//$c->add
self::addSelectColumns($c);
$c->addAsColumn("sort_order", "ABS(DATEDIFF(COALESCE(" . self::MISSION_DATE . ", \"1970-01-01\"), NOW()))");
$c->addAscendingOrderByColumn('sort_order');
$pager = new sfPropelPager('Mission', $max);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例3: getMissingWaiversPager
public static function getMissingWaiversPager($max = 10, $page = 1, $miss_date1 = null, $miss_date2 = null, $pass_name = null, $pilot_name = null, $wing = null)
{
$c = new Criteria();
$c->addJoin(self::MISSION_ID, MissionPeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(MissionPeer::PASSENGER_ID, PassengerPeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(self::PILOT_ID, PilotPeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(PilotPeer::MEMBER_ID, MemberPeer::alias('m2', MemberPeer::ID), Criteria::LEFT_JOIN);
//person
$c->addJoin(PassengerPeer::PERSON_ID, PersonPeer::alias('p1', PersonPeer::ID), Criteria::LEFT_JOIN);
$c->addJoin(MemberPeer::alias('m2', MemberPeer::PERSON_ID), PersonPeer::alias('p2', PersonPeer::ID), Criteria::LEFT_JOIN);
$c->addAlias('p1', PersonPeer::TABLE_NAME);
$c->addAlias('p2', PersonPeer::TABLE_NAME);
$c->addAlias('m1', MemberPeer::TABLE_NAME);
$c->addAlias('m2', MemberPeer::TABLE_NAME);
//member
$c->addJoin(PersonPeer::alias('p1', PersonPeer::ID), MemberPeer::alias('m1', MemberPeer::PERSON_ID), Criteria::LEFT_JOIN);
if (!empty($miss_date1) && !empty($miss_date2)) {
$miss_date1 = date('Y-m-d', strtotime($miss_date1)) . ' 00:00:00';
$miss_date2 = date('Y-m-d', strtotime($miss_date2)) . ' 00:00:00';
$criterion = $c->getNewCriterion(MissionPeer::MISSION_DATE, $miss_date1, Criteria::GREATER_EQUAL);
$criterion->addAnd($c->getNewCriterion(MissionPeer::MISSION_DATE, $miss_date2, Criteria::LESS_EQUAL));
$c->add($criterion);
} elseif ($miss_date1) {
$miss_date1 = date('Y-m-d', strtotime($miss_date1)) . ' 00:00:00';
$c->add(MissionPeer::MISSION_DATE, $miss_date1, Criteria::GREATER_EQUAL);
} elseif ($miss_date2) {
$miss_date2 = date('Y-m-d', strtotime($miss_date2)) . ' 00:00:00';
$c->add(MissionPeer::MISSION_DATE, $miss_date2, Criteria::GREATER_EQUAL);
}
if ($pass_name) {
$criterion = $c->getNewCriterion(PersonPeer::alias("p1", PersonPeer::FIRST_NAME), $pass_name . '%', Criteria::LIKE);
$criterion->addOr($c->getNewCriterion(PersonPeer::alias("p1", PersonPeer::LAST_NAME), $pass_name . '%', Criteria::LIKE));
$c->add($criterion);
}
if ($pilot_name) {
$criterion = $c->getNewCriterion(PersonPeer::alias("p2", PersonPeer::FIRST_NAME), $pilot_name . '%', Criteria::LIKE);
$criterion->addOr($c->getNewCriterion(PersonPeer::alias("p2", PersonPeer::LAST_NAME), $pilot_name . '%', Criteria::LIKE));
$c->add($criterion);
}
if ($wing) {
$c->add(MemberPeer::alias('m1', MemberPeer::WING_ID), $wing);
}
$c->add(self::WAIVER_RECEIVED, null, Criteria::ISNULL);
$c->addAscendingOrderByColumn(self::ID);
// return self::doSelect($c);
$pager = new sfPropelPager('MissionLeg', $max);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
return $pager;
}