Created
May 19, 2009 14:16
-
-
Save hartym/114122 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
$result = $this | |
->createQuery('r') | |
->select('r.*, e.*') | |
->from('BookingResource r') | |
->leftJoin( | |
'r.Entries e ON '. | |
'( ( e.ending_at > :start AND e.ending_at <= :end ) OR '. | |
' ( e.starting_at < :end AND e.starting_at >= :start ) OR '. | |
' ( e.starting_at < :start AND e.ending_at > :end ) )' | |
) | |
->orderBy('e.starting_at') | |
->where('r.category_id = :category_id') | |
->execute( | |
array( | |
':start' => $start->get(), | |
':end' => $end->get(), | |
':category_id' => $category['id'], | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment