Last active
September 5, 2015 20:09
-
-
Save pomek/3f3bda7e15e0ced981a0 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
namespace Search; | |
class SearchQueryParams | |
{ | |
// … | |
public function getLocation() | |
{ | |
return $this->location; | |
} | |
public function getPeople() | |
{ | |
return $this->people; | |
} | |
public function getEventTypeId() | |
{ | |
return $this->eventTypeId; | |
} | |
// … | |
} | |
namespace Search\Repository; | |
class SearchRepository | |
{ | |
// … | |
public function getRoomsByCriteria(SearchQueryParams $params) | |
{ | |
// … | |
if (null !== $params->getLocation()) { | |
$query->where(‘location’, $params->getLocation()); | |
} | |
if (null !== $params->getEventTypeId()) { | |
$query->where(‘event_type_id’, $params->getEventTypeId()); | |
} | |
if (null !== $params->getPeople()) { | |
$query->where(‘capacity’, $params->getPeople()); | |
} | |
// … | |
} | |
// … | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment