|  | 
| 1 | 1 | # Doctrine Specification | 
| 2 |  | -[](https://travis-ci.org/rikbruil/Doctrine-Specification) | 
| 3 |  | -[](https://coveralls.io/r/rikbruil/Doctrine-Specification?branch=master) | 
| 4 |  | -[](https://packagist.org/packages/rikbruil/doctrine-specification) | 
| 5 |  | -[](https://packagist.org/packages/rikbruil/doctrine-specification) | 
| 6 |  | -[](https://scrutinizer-ci.com/g/rikbruil/Doctrine-Specification/?branch=master) | 
| 7 |  | -[](https://insight.sensiolabs.com/projects/bb221821-1ba6-4613-b39f-f43718aaa92d) | 
| 8 | 2 | 
 | 
| 9 |  | -Doctrine [Specification pattern][specification_pattern] for building queries dynamically and with re-usable classes for composition. | 
|  | 3 | +Doctrine [Specification pattern][specification_pattern] for building queries dynamically and with re-usable classes for | 
|  | 4 | +composition. | 
| 10 | 5 | 
 | 
| 11 |  | -This library started out as an adaptation of Benjamin Eberlei's [blog post][blog_post]. I was also inspired by the [Happyr Doctrine-Specification][happyr_spec] code, however this library has some small differences. | 
| 12 |  | -The main one is that SpecificationRepository->match() does not return the results directly, but returns the query object. | 
|  | 6 | +This library started out as an adaptation of Benjamin Eberlei's [blog post][blog_post]. I was also inspired by | 
|  | 7 | +the [Happyr Doctrine-Specification][happyr_spec] code, however this library has some small differences. | 
|  | 8 | +The main one is that SpecificationRepository->match() does not return the results directly, but returns the query | 
|  | 9 | +object. | 
| 13 | 10 | 
 | 
| 14 | 11 | Since I like Doctrine's Paginator object, I wanted to be able to use that in combination with the Specification pattern. | 
| 15 | 12 | 
 | 
| 16 |  | -__Note:__ In versions prior to 1.2 it was required to extend the SpecificationRepository class. This is no longer needed since we provide a SpecificationRepositoryTrait that you can use instead. | 
| 17 |  | -The class is still provided for backwards compatibility reasons. There is also the SpecificationAwareInterface that you can use if you need it. | 
|  | 13 | +__Note:__ In versions prior to 1.2 it was required to extend the SpecificationRepository class. This is no longer needed | 
|  | 14 | +since we provide a SpecificationRepositoryTrait that you can use instead. | 
|  | 15 | +The class is still provided for backwards compatibility reasons. There is also the SpecificationAwareInterface that you | 
|  | 16 | +can use if you need it. | 
| 18 | 17 | 
 | 
| 19 | 18 | ## Usage | 
| 20 | 19 | 
 | 
| 21 |  | -Install the latest version with `composer require rikbruil/doctrine-specification` | 
|  | 20 | +Install the latest version with `composer require purist/doctrine-specification` | 
| 22 | 21 | 
 | 
| 23 | 22 | ```php | 
| 24 | 23 | // Not using the lib | 
| @@ -67,6 +66,7 @@ return $this->em->getRepository('Advertisement')->match($spec)->execute(); | 
| 67 | 66 | ``` | 
| 68 | 67 | 
 | 
| 69 | 68 | ## Composition | 
|  | 69 | + | 
| 70 | 70 | A bonus of this pattern is composition, which makes specifications very reusable: | 
| 71 | 71 | 
 | 
| 72 | 72 | ```php | 
| @@ -168,5 +168,7 @@ This library is heavily inspired by Benjamin Eberlei's [blog post][blog_post] | 
| 168 | 168 | and [Happyr's Doctrine-Specification library][happyr_spec]. | 
| 169 | 169 | 
 | 
| 170 | 170 | [specification_pattern]: http://en.wikipedia.org/wiki/Specification_pattern | 
|  | 171 | + | 
| 171 | 172 | [happyr_spec]: https://github.com/Happyr/Doctrine-Specification | 
|  | 173 | + | 
| 172 | 174 | [blog_post]: http://www.whitewashing.de/2013/03/04/doctrine_repositories.html | 
0 commit comments