/** * @param Uuid $identifier * * @return Member */ public function getMember(Uuid $identifier) { $statement = $this->pdo->prepare('SELECT * FROM members WHERE identifier = :identifier'); $statement->bindValue('identifier', $identifier->getValue()); $statement->execute(); if ($statement->rowCount() === 0) { throw new \PDOException('Member not found'); } return $this->rowToMember($statement->fetchObject()); }
/** * @param Uuid $identifier * * @return Meetup */ public function getMeetup(Uuid $identifier) { $statement = $this->pdo->prepare('SELECT m.*, count(r.member_identifier) as taken FROM meetups m LEFT JOIN rsvps r ON (r.meetup_identifier = m.identifier AND r.rsvp = "yes") WHERE m.identifier = :identifier GROUP BY m.identifier'); $statement->bindValue('identifier', $identifier->getValue()); $statement->execute(); if ($statement->rowCount() === 0) { throw new \PDOException('Meetup not found'); } return $this->rowToMeetup($statement->fetchObject()); }
public function testGetValueMethod() { $this->assertEquals($this->uuid->getValue(), '99999'); }