Selectable.php 1023 B

1234567891011121314151617181920212223242526272829303132
  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. * @phpstan-template TKey
  16. * @psalm-template TKey as array-key
  17. * @psalm-template T
  18. */
  19. interface Selectable
  20. {
  21. /**
  22. * Selects all elements from a selectable that match the expression and
  23. * returns a new collection containing these elements.
  24. *
  25. * @return Collection
  26. *
  27. * @psalm-return Collection<TKey,T>
  28. */
  29. public function matching(Criteria $criteria);
  30. }