1 | <?php |
||
23 | class QueryObject extends Select implements QueryObjectInterface |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * @var RepositoryInterface |
||
28 | */ |
||
29 | protected $repository; |
||
30 | |||
31 | /** |
||
32 | * For triggering events |
||
33 | */ |
||
34 | use SelectEventTriggers; |
||
35 | |||
36 | /** |
||
37 | * QueryObject has a repository as a dependency. |
||
38 | * |
||
39 | * @param RepositoryInterface $repository |
||
40 | */ |
||
41 | 12 | public function __construct(RepositoryInterface $repository) |
|
50 | |||
51 | /** |
||
52 | * Retrieve all records matching this select query |
||
53 | * |
||
54 | * @return \Slick\Database\RecordList |
||
55 | */ |
||
56 | 6 | public function all() |
|
81 | |||
82 | /** |
||
83 | * Retrieve first record matching this select query |
||
84 | * |
||
85 | * @return EntityInterface|null |
||
86 | */ |
||
87 | 2 | public function first() |
|
117 | |||
118 | /** |
||
119 | * Gets the id for this query |
||
120 | * |
||
121 | * @param QueryObjectInterface $query |
||
122 | * |
||
123 | * @return string |
||
124 | */ |
||
125 | 8 | protected function getId(QueryObjectInterface $query) |
|
132 | |||
133 | /** |
||
134 | * Registers every entity in collection to the repository identity map |
||
135 | * |
||
136 | * @param EntityCollection $collection |
||
137 | * |
||
138 | * @return self |
||
139 | */ |
||
140 | 6 | protected function updateIdentityMap(EntityCollection $collection) |
|
152 | |||
153 | /** |
||
154 | * Returns the repository that is using this query object |
||
155 | * |
||
156 | * @return RepositoryInterface |
||
157 | */ |
||
158 | 10 | public function getRepository() |
|
162 | |||
163 | /** |
||
164 | * Gets current entity class name |
||
165 | * |
||
166 | * @return string |
||
167 | */ |
||
168 | 6 | public function getEntityClassName() |
|
172 | } |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.