| @@ 43-51 (lines=9) @@ | ||
| 40 | return $this->matchContent($conditions, $sort, $offset, $limit); |
|
| 41 | } |
|
| 42 | ||
| 43 | public function matchOne(array $conditions, array $sort = array(), $offset = 0, $limit = 0) |
|
| 44 | { |
|
| 45 | $results = $this->match($conditions, $sort, $offset, $limit); |
|
| 46 | $count = count($results); |
|
| 47 | if ($count !== 1) { |
|
| 48 | throw new \Exception("Found $count " . $this->returns . " when expected exactly only one to match the conditions"); |
|
| 49 | } |
|
| 50 | return reset($results); |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * @param array $conditions key: condition, value: int / string / int[] / string[] |
|
| @@ 45-53 (lines=9) @@ | ||
| 42 | return $this->matchLocation($conditions, $sort, $offset, $limit); |
|
| 43 | } |
|
| 44 | ||
| 45 | public function matchOne(array $conditions, array $sort = array(), $offset = 0, $limit = 0) |
|
| 46 | { |
|
| 47 | $results = $this->match($conditions, $sort, $offset, $limit); |
|
| 48 | $count = count($results); |
|
| 49 | if ($count !== 1) { |
|
| 50 | throw new \Exception("Found $count " . $this->returns . " when expected exactly only one to match the conditions"); |
|
| 51 | } |
|
| 52 | return reset($results); |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * @param array $conditions key: condition, value: value: int / string / int[] / string[] |
|