1 | <?php |
||
33 | class DocumentRepository implements ObjectRepository, Selectable |
||
34 | { |
||
35 | /** @var string */ |
||
36 | protected $documentName; |
||
37 | |||
38 | /** @var DocumentManager */ |
||
39 | protected $dm; |
||
40 | |||
41 | /** @var UnitOfWork */ |
||
42 | protected $uow; |
||
43 | |||
44 | /** @var ClassMetadata */ |
||
45 | protected $class; |
||
46 | |||
47 | /** |
||
48 | * Initializes this instance with the specified document manager, unit of work and |
||
49 | * class metadata. |
||
50 | * |
||
51 | * @param DocumentManager $dm The DocumentManager to use. |
||
52 | * @param UnitOfWork $uow The UnitOfWork to use. |
||
53 | * @param ClassMetadata $classMetadata The class metadata. |
||
54 | */ |
||
55 | 356 | public function __construct(DocumentManager $dm, UnitOfWork $uow, ClassMetadata $classMetadata) |
|
56 | { |
||
57 | 356 | $this->documentName = $classMetadata->name; |
|
58 | 356 | $this->dm = $dm; |
|
59 | 356 | $this->uow = $uow; |
|
60 | 356 | $this->class = $classMetadata; |
|
61 | 356 | } |
|
62 | |||
63 | /** |
||
64 | * Creates a new Query\Builder instance that is preconfigured for this document name. |
||
65 | */ |
||
66 | 15 | public function createQueryBuilder() : QueryBuilder |
|
70 | |||
71 | /** |
||
72 | * Creates a new Aggregation\Builder instance that is prepopulated for this document name. |
||
73 | */ |
||
74 | public function createAggregationBuilder() : AggregationBuilder |
||
78 | |||
79 | /** |
||
80 | * Clears the repository, causing all managed documents to become detached. |
||
81 | */ |
||
82 | public function clear() : void |
||
86 | |||
87 | /** |
||
88 | * Finds a document matching the specified identifier. Optionally a lock mode and |
||
89 | * expected version may be specified. |
||
90 | * |
||
91 | * @param mixed $id Identifier. |
||
92 | * |
||
93 | * @throws MappingException |
||
94 | * @throws LockException |
||
95 | */ |
||
96 | 249 | public function find($id, int $lockMode = LockMode::NONE, ?int $lockVersion = null) : ?object |
|
144 | |||
145 | /** |
||
146 | * Finds all documents in the repository. |
||
147 | */ |
||
148 | 10 | public function findAll() : array |
|
152 | |||
153 | /** |
||
154 | * Finds documents by a set of criteria. |
||
155 | * |
||
156 | * @param int|null $limit |
||
157 | * @param int|null $skip |
||
158 | */ |
||
159 | 11 | public function findBy(array $criteria, ?array $sort = null, $limit = null, $skip = null) : array |
|
163 | |||
164 | /** |
||
165 | * Finds a single document by a set of criteria. |
||
166 | */ |
||
167 | 84 | public function findOneBy(array $criteria) : ?object |
|
171 | |||
172 | 8 | public function getDocumentName() : string |
|
176 | |||
177 | public function getDocumentManager() : DocumentManager |
||
181 | |||
182 | public function getClassMetadata() : ClassMetadata |
||
186 | |||
187 | 8 | public function getClassName() : string |
|
191 | |||
192 | /** |
||
193 | * Selects all elements from a selectable that match the expression and |
||
194 | * returns a new collection containing these elements. |
||
195 | * |
||
196 | * @see Selectable::matching() |
||
197 | */ |
||
198 | 4 | public function matching(Criteria $criteria) : ArrayCollection |
|
225 | |||
226 | 334 | protected function getDocumentPersister() : DocumentPersister |
|
230 | } |
||
231 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.