Selectable.php 997 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace Doctrine\Common\Collections;
  3. /**
  4. * Interface for collections that allow efficient filtering with an expression API.
  5. *
  6. * Goal of this interface is a backend independent method to fetch elements
  7. * from a collections. {@link Expression} is crafted in a way that you can
  8. * implement queries from both in-memory and database-backed collections.
  9. *
  10. * For database backed collections this allows very efficient access by
  11. * utilizing the query APIs, for example SQL in the ORM. Applications using
  12. * this API can implement efficient database access without having to ask the
  13. * EntityManager or Repositories.
  14. *
  15. * @psalm-template TKey as array-key
  16. * @psalm-template T
  17. */
  18. interface Selectable
  19. {
  20. /**
  21. * Selects all elements from a selectable that match the expression and
  22. * returns a new collection containing these elements.
  23. *
  24. * @return Collection
  25. *
  26. * @psalm-return Collection<TKey,T>
  27. */
  28. public function matching(Criteria $criteria);
  29. }