/** * Get the associated Room object * * @param PropelPDO Optional Connection object. * @return Room The associated Room object. * @throws PropelException */ public function getRoom(PropelPDO $con = null) { if ($this->aRoom === null && $this->room_id !== null) { $c = new Criteria(RoomPeer::DATABASE_NAME); $c->add(RoomPeer::ID, $this->room_id); $this->aRoom = RoomPeer::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->aRoom->addRoomHasFeaturevalues($this); */ } return $this->aRoom; }
/** * Description : Retrieve a room from data base by code * * @param String $roomCode : code of a room * @return : Room object */ public function getRoomByCode($roomCode) { try { $criteria = new Criteria(); $criteria->add(RoomPeer::CODE, $roomCode); return RoomPeer::doSelectOne($criteria); } catch (Exception $e) { return null; } }