Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pomek/3f3bda7e15e0ced981a0 to your computer and use it in GitHub Desktop.
Save pomek/3f3bda7e15e0ced981a0 to your computer and use it in GitHub Desktop.
<?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