您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

AbstractRepositoryInterface.php 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. namespace Lc\SovBundle\Repository;
  3. use Doctrine\Common\Collections\Collection;
  4. use Doctrine\Common\Collections\Criteria;
  5. use Doctrine\ORM\AbstractQuery;
  6. use Doctrine\ORM\LazyCriteriaCollection;
  7. use Doctrine\ORM\NativeQuery;
  8. use Doctrine\ORM\Query;
  9. use Doctrine\ORM\Query\ResultSetMappingBuilder;
  10. use Doctrine\ORM\QueryBuilder;
  11. interface AbstractRepositoryInterface
  12. {
  13. public function setDefaultLocale($locale);
  14. public function getOneOrNullResult(QueryBuilder $qb, $locale = null, $hydrationMode = null);
  15. public function getResult(QueryBuilder $qb, $locale = null, $hydrationMode = AbstractQuery::HYDRATE_OBJECT);
  16. public function getArrayResult(QueryBuilder $qb, $locale = null);
  17. public function getSingleResult(QueryBuilder $qb, $locale = null, $hydrationMode = null);
  18. public function getScalarResult(QueryBuilder $qb, $locale = null);
  19. public function getSingleScalarResult(QueryBuilder $qb, $locale = null);
  20. /**
  21. * Creates a new QueryBuilder instance that is prepopulated for this entity name.
  22. *
  23. * @param string $alias
  24. * @param string $indexBy The index for the from.
  25. *
  26. * @return QueryBuilder
  27. */
  28. public function createQueryBuilder($alias, $indexBy = null);
  29. /**
  30. * Creates a new result set mapping builder for this entity.
  31. *
  32. * The column naming strategy is "INCREMENT".
  33. *
  34. * @param string $alias
  35. *
  36. * @return ResultSetMappingBuilder
  37. */
  38. public function createResultSetMappingBuilder($alias);
  39. /**
  40. * Creates a new Query instance based on a predefined metadata named query.
  41. *
  42. * @param string $queryName
  43. *
  44. * @return Query
  45. * @deprecated
  46. *
  47. */
  48. public function createNamedQuery($queryName);
  49. /**
  50. * Creates a native SQL query.
  51. *
  52. * @param string $queryName
  53. *
  54. * @return NativeQuery
  55. * @deprecated
  56. *
  57. */
  58. public function createNativeNamedQuery($queryName);
  59. /**
  60. * Clears the repository, causing all managed entities to become detached.
  61. *
  62. * @deprecated 2.8 This method is being removed from the ORM and won't have any replacement
  63. *
  64. * @return void
  65. */
  66. public function clear();
  67. /**
  68. * Finds an entity by its primary key / identifier.
  69. *
  70. * @param mixed $id The identifier.
  71. * @param int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants
  72. * or NULL if no specific lock mode should be used
  73. * during the search.
  74. * @param int|null $lockVersion The lock version.
  75. *
  76. * @return object|null The entity instance or NULL if the entity can not be found.
  77. * @psalm-return ?T
  78. */
  79. public function find($id, $lockMode = null, $lockVersion = null);
  80. /**
  81. * Finds all entities in the repository.
  82. *
  83. * @psalm-return list<T> The entities.
  84. */
  85. public function findAll();
  86. /**
  87. * Finds entities by a set of criteria.
  88. *
  89. * @param int|null $limit
  90. * @param int|null $offset
  91. * @psalm-param array<string, mixed> $criteria
  92. * @psalm-param array<string, string>|null $orderBy
  93. *
  94. * @psalm-return list<T> The objects.
  95. */
  96. public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null);
  97. /**
  98. * Finds a single entity by a set of criteria.
  99. *
  100. * @psalm-param array<string, mixed> $criteria
  101. * @psalm-param array<string, string>|null $orderBy
  102. *
  103. * @return object|null The entity instance or NULL if the entity can not be found.
  104. * @psalm-return ?T
  105. */
  106. public function findOneBy(array $criteria, ?array $orderBy = null);
  107. /**
  108. * Counts entities by a set of criteria.
  109. *
  110. * @psalm-param array<string, mixed> $criteria
  111. *
  112. * @return int The cardinality of the objects that match the given criteria.
  113. *
  114. * @todo Add this method to `ObjectRepository` interface in the next major release
  115. */
  116. public function count(array $criteria);
  117. /**
  118. * @return string
  119. */
  120. public function getClassName();
  121. /**
  122. * Select all elements from a selectable that match the expression and
  123. * return a new collection containing these elements.
  124. *
  125. * @return LazyCriteriaCollection
  126. * @psalm-return Collection<int, T>
  127. */
  128. public function matching(Criteria $criteria);
  129. }