Created
March 5, 2015 19:29
-
-
Save kaworu/25ff1c0879db363ba167 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* filter only the bookings for the given date. | |
* @see http://doctrine-orm.readthedocs.org/en/latest/reference/working-with-associations.html#filtering-collections | |
*/ | |
public function getBookingsOn(\DateTime $date) | |
{ | |
$the_day = new \DateTime($date->format('Y-m-d')); | |
$the_day_after = $the_day->add(new \DateInterval('P1D')); | |
$critera = Critera::create() | |
->where(Critera::expr()->gte('startAt', $the_day)) | |
->andWhere(Critera::expr()->lt('startAt', $the_day_after)) | |
->orderBy(['startAt' => Criteria::ASC]); | |
$bookings = $this->getBookings()->matching($critera); | |
return $bookings; | |
} |
Author
kaworu
commented
Mar 5, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment