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) |
|
49 | |||
50 | /** |
||
51 | * Retrieve all records matching this select query |
||
52 | * |
||
53 | * @return \Slick\Database\RecordList |
||
54 | */ |
||
55 | 6 | public function all() |
|
72 | |||
73 | /** |
||
74 | * Retrieve first record matching this select query |
||
75 | * |
||
76 | * @return EntityInterface|null |
||
77 | */ |
||
78 | 2 | public function first() |
|
108 | |||
109 | /** |
||
110 | * Gets the id for this query |
||
111 | * |
||
112 | * @param QueryObjectInterface $query |
||
113 | * |
||
114 | * @return string |
||
115 | */ |
||
116 | 8 | protected function getId(QueryObjectInterface $query) |
|
123 | |||
124 | /** |
||
125 | * Registers every entity in collection to the repository identity map |
||
126 | * |
||
127 | * @param EntityCollection $collection |
||
128 | * |
||
129 | * @return self |
||
130 | */ |
||
131 | 6 | protected function updateIdentityMap(EntityCollection $collection) |
|
143 | |||
144 | /** |
||
145 | * Returns the repository that is using this query object |
||
146 | * |
||
147 | * @return RepositoryInterface |
||
148 | */ |
||
149 | 10 | public function getRepository() |
|
153 | |||
154 | /** |
||
155 | * Gets current entity class name |
||
156 | * |
||
157 | * @return string |
||
158 | */ |
||
159 | 2 | public function getEntityClassName() |
|
163 | } |
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.