Skip to content
This repository has been archived by the owner on May 1, 2019. It is now read-only.

Commit

Permalink
Enhancement: Clean up query beforehand, return early
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Feb 18, 2015
1 parent 20e2b01 commit 769e5d5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions module/ZfModule/src/ZfModule/Mapper/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ public function findByLike($query, $limit = null, $orderBy = null, $sort = 'ASC'

private function whereLike(Sql\Select $select, $query)
{
$query = preg_replace('/\s+/', ' ', $query);

if (!trim($query)) {
return;
}

$words = explode(' ', $query);

$select->where(function ($where) use ($words) {
Expand Down

0 comments on commit 769e5d5

Please sign in to comment.