1 | <?php |
||
31 | class DocumentRepository implements ObjectRepository, Selectable |
||
32 | { |
||
33 | /** @var string */ |
||
34 | protected $documentName; |
||
35 | |||
36 | /** @var DocumentManager */ |
||
37 | protected $dm; |
||
38 | |||
39 | /** @var UnitOfWork */ |
||
40 | protected $uow; |
||
41 | |||
42 | /** @var ClassMetadata */ |
||
43 | protected $class; |
||
44 | |||
45 | /** |
||
46 | * Initializes this instance with the specified document manager, unit of work and |
||
47 | * class metadata. |
||
48 | * |
||
49 | * @param DocumentManager $dm The DocumentManager to use. |
||
50 | * @param UnitOfWork $uow The UnitOfWork to use. |
||
51 | * @param ClassMetadata $classMetadata The class metadata. |
||
52 | */ |
||
53 | 357 | public function __construct(DocumentManager $dm, UnitOfWork $uow, ClassMetadata $classMetadata) |
|
60 | |||
61 | /** |
||
62 | * Creates a new Query\Builder instance that is preconfigured for this document name. |
||
63 | */ |
||
64 | 16 | public function createQueryBuilder(): QueryBuilder |
|
68 | |||
69 | /** |
||
70 | * Creates a new Aggregation\Builder instance that is prepopulated for this document name. |
||
71 | */ |
||
72 | public function createAggregationBuilder(): AggregationBuilder |
||
76 | |||
77 | /** |
||
78 | * Clears the repository, causing all managed documents to become detached. |
||
79 | */ |
||
80 | public function clear(): void |
||
84 | |||
85 | /** |
||
86 | * Finds a document matching the specified identifier. Optionally a lock mode and |
||
87 | * expected version may be specified. |
||
88 | * |
||
89 | * @param mixed $id Identifier. |
||
90 | * @throws MappingException |
||
91 | * @throws LockException |
||
92 | */ |
||
93 | 250 | public function find($id, int $lockMode = LockMode::NONE, ?int $lockVersion = null): ?object |
|
141 | |||
142 | /** |
||
143 | * Finds all documents in the repository. |
||
144 | */ |
||
145 | 10 | public function findAll(): array |
|
146 | { |
||
147 | 10 | return $this->findBy([]); |
|
148 | } |
||
149 | |||
150 | /** |
||
151 | * Finds documents by a set of criteria. |
||
152 | * |
||
153 | * @param int|null $limit |
||
154 | * @param int|null $offset |
||
|
|||
155 | */ |
||
156 | 11 | public function findBy(array $criteria, ?array $sort = null, $limit = null, $skip = null): array |
|
157 | { |
||
158 | 11 | return $this->getDocumentPersister()->loadAll($criteria, $sort, $limit, $skip)->toArray(false); |
|
159 | } |
||
160 | |||
161 | /** |
||
162 | * Finds a single document by a set of criteria. |
||
163 | */ |
||
164 | 84 | public function findOneBy(array $criteria): ?object |
|
165 | { |
||
166 | 84 | return $this->getDocumentPersister()->load($criteria); |
|
167 | } |
||
168 | |||
169 | 8 | public function getDocumentName(): string |
|
173 | |||
174 | public function getDocumentManager(): DocumentManager |
||
175 | { |
||
176 | return $this->dm; |
||
178 | |||
179 | public function getClassMetadata(): ClassMetadata |
||
183 | |||
184 | 8 | public function getClassName(): string |
|
188 | |||
189 | /** |
||
190 | * Selects all elements from a selectable that match the expression and |
||
191 | * returns a new collection containing these elements. |
||
192 | * |
||
193 | * @see Selectable::matching() |
||
194 | */ |
||
195 | 4 | public function matching(Criteria $criteria): ArrayCollection |
|
220 | |||
221 | 335 | protected function getDocumentPersister(): DocumentPersister |
|
225 | } |
||
226 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.