public static function retrieveByCodes($member_codes, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($member_codes)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(MemberPeer::CODE, $member_codes, Criteria::IN); $objs = MemberPeer::doSelect($criteria, $con); } return $objs; }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(MemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(MemberPeer::DATABASE_NAME); $criteria->add(MemberPeer::ID, $pks, Criteria::IN); $objs = MemberPeer::doSelect($criteria, $con); } return $objs; }
public function getMembers($criteria = null, $con = null) { include_once 'lib/model/om/BaseMemberPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collMembers === null) { if ($this->isNew()) { $this->collMembers = array(); } else { $criteria->add(MemberPeer::MEMBER_DETAIL_ID, $this->getId()); MemberPeer::addSelectColumns($criteria); $this->collMembers = MemberPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(MemberPeer::MEMBER_DETAIL_ID, $this->getId()); MemberPeer::addSelectColumns($criteria); if (!isset($this->lastMemberCriteria) || !$this->lastMemberCriteria->equals($criteria)) { $this->collMembers = MemberPeer::doSelect($criteria, $con); } } } $this->lastMemberCriteria = $criteria; return $this->collMembers; }
/** * Gets an array of Member objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this Person has previously been saved, it will retrieve * related Members from storage. If this Person is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array Member[] * @throws PropelException */ public function getMembers($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(PersonPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collMembers === null) { if ($this->isNew()) { $this->collMembers = array(); } else { $criteria->add(MemberPeer::PERSON_ID, $this->id); MemberPeer::addSelectColumns($criteria); $this->collMembers = MemberPeer::doSelect($criteria, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(MemberPeer::PERSON_ID, $this->id); MemberPeer::addSelectColumns($criteria); if (!isset($this->lastMemberCriteria) || !$this->lastMemberCriteria->equals($criteria)) { $this->collMembers = MemberPeer::doSelect($criteria, $con); } } } $this->lastMemberCriteria = $criteria; return $this->collMembers; }
public function executeGetList() { if ($this->hasRequestParameter('member_name') && $this->getRequestParameter('member_name') != '') { $c = new Criteria(); $cton1 = $c->getNewCriterion(MemberPeer::NAME, '%' . $this->getRequestParameter('member_name') . '%', Criteria::LIKE); $cton2 = $c->getNewCriterion(MemberPeer::CODE, '%' . $this->getRequestParameter('member_name') . '%', Criteria::LIKE); $cton3 = $c->getNewCriterion(MemberPeer::NO_REG, '%' . $this->getRequestParameter('member_name') . '%', Criteria::LIKE); $cton2->addOr($cton3); $cton1->addOr($cton2); $c->add($cton1); $c->add(MemberPeer::STATUS, Member::IS_EMPLOYEE, Criteria::NOT_EQUAL); $this->rows = MemberPeer::doSelect($c); $c2 = new Criteria(); $cton7 = $c2->getNewCriterion(MemberPeer::NAME, '%' . $this->getRequestParameter('member_name') . '%', Criteria::LIKE); $cton8 = $c2->getNewCriterion(MemberPeer::CODE, '%' . $this->getRequestParameter('member_name') . '%', Criteria::LIKE); $cton9 = $c2->getNewCriterion(MemberPeer::NO_REG, '%' . $this->getRequestParameter('member_name') . '%', Criteria::LIKE); $cton8->addOr($cton9); $cton7->addOr($cton8); $c2->add($cton7); $c2->add(MemberPeer::STATUS, Member::IS_STUDENT, Criteria::NOT_EQUAL); $this->rows2 = MemberPeer::doSelect($c2); } }