public static function authenticate($card_number, $pincode) { $c = new Criteria(); $c->add(CardPeer::CARD_NUMBER, $card_number, Criteria::EQUAL); $c->addAnd(CardPeer::PIN_CODE, $pincode, Criteria::EQUAL); $c->addAnd(CardPeer::IS_ACTIVE, true, Criteria::EQUAL); $c->addAnd(CardPeer::OWNER, null, Criteria::ISNOTNULL); $card = CardPeer::doSelectOne($c); if (!$card || !$card->isOwned()) { return null; } return $card; }
/** * Get the associated Card object * * @param PropelPDO Optional Connection object. * @return Card The associated Card object. * @throws PropelException */ public function getCard(PropelPDO $con = null) { if ($this->aCard === null && $this->card_id !== null) { $c = new Criteria(CardPeer::DATABASE_NAME); $c->add(CardPeer::ID, $this->card_id); $this->aCard = CardPeer::doSelectOne($c, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aCard->addReservations($this); */ } return $this->aCard; }