2017 © Pedro Peláez
 

library specifications

A specifications library for the Doctrine ORM

image

infinite-networks/specifications

A specifications library for the Doctrine ORM

  • Thursday, May 25, 2017
  • by merk
  • Repository
  • 4 Watchers
  • 7 Stars
  • 472 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 11 Versions
  • 1 % Grown

The README.md

Infinite Specifications Library

This library is a base set of objects following the Specification pattern and based on a blog post about taming Doctrines EntityRepository classes., (*1)

http://www.whitewashing.de/2013/03/04/doctrine_repositories.html, (*2)

How to use this library

This library adds 2 methods to the base EntityRepository class, match and matchOne, which both accept a specification that will build a query builder. Developers need to implement specifications that meet their domain requirements, and each specification must implement the Infinite\Specification\ORM\Specification interface., (*3)

An example of what using this library could look like:, (*4)


use Infinite\Specification\ORM as Spec; $repository = $managerRegistry->getRepository('Entity\User'); // Retrieve any enabled users, ordered by username $enabledUsersSpec = new Spec\Sort(array('username' => 'ASC'), new Spec\AndX(array( new Spec\Equals('enabled', 1) )); $enabledUsers = $repository->match($enabledUsersSpec); // Count enabled users $countEnabledUsersSpec = new Spec\SingleScalar(new Spec\Count(new Spec\Equals('enabled', 1))); $enabledUsersCount = $repository->matchOne($countEnabledUsersSpec);

Doctrine must be configured to use a different base EntityRepository class, and any EntityRepositories implemented in your application must use the EntityRepository class defined in this library as their base class., (*5)

To define a different EntityRepository base class in Symfony2, add the following configuration:, (*6)

doctrine:
    orm:
        default_repository_class: Infinite\Specification\ORM\EntityRepository

The Versions

25/05 2017

dev-master

9999999-dev

A specifications library for the Doctrine ORM

  Sources   Download

MIT

The Requires

 

by Tim Nagel

25/05 2017

1.0.9

1.0.9.0

A specifications library for the Doctrine ORM

  Sources   Download

MIT

The Requires

 

by Tim Nagel

21/06 2016

1.0.8

1.0.8.0

A specifications library for the Doctrine ORM

  Sources   Download

MIT

The Requires

 

by Tim Nagel

17/03 2016

1.0.7

1.0.7.0

A specifications library for the Doctrine ORM

  Sources   Download

MIT

The Requires

 

by Tim Nagel

21/11 2015

1.0.6

1.0.6.0

A specifications library for the Doctrine ORM

  Sources   Download

MIT

The Requires

 

by Tim Nagel

30/06 2015

1.0.5

1.0.5.0

A specifications library for the Doctrine ORM

  Sources   Download

MIT

The Requires

 

by Tim Nagel

29/06 2015

1.0.4

1.0.4.0

A specifications library for the Doctrine ORM

  Sources   Download

MIT

The Requires

 

by Tim Nagel

25/06 2015

1.0.3

1.0.3.0

A specifications library for the Doctrine ORM

  Sources   Download

MIT

The Requires

 

by Tim Nagel

25/06 2015

1.0.2

1.0.2.0

A specifications library for the Doctrine ORM

  Sources   Download

MIT

The Requires

 

by Tim Nagel

01/06 2015

1.0.1

1.0.1.0

A specifications library for the Doctrine ORM

  Sources   Download

MIT

The Requires

 

by Tim Nagel

06/05 2015

1.0.0

1.0.0.0

A specifications library for the Doctrine ORM

  Sources   Download

MIT

The Requires

 

by Tim Nagel