Conditions | 2 |
Paths | 2 |
Total Lines | 24 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
20 | public function findConfirmationSubject($propertyPath, $value) |
||
21 | { |
||
22 | $queryBuilder = $this->getQueryBuilder(); |
||
|
|||
23 | $paths = explode('.', $propertyPath); |
||
24 | |||
25 | // support only 1 step join |
||
26 | if (count($paths) > 1) { |
||
27 | $queryBuilder |
||
28 | ->join($this->getPropertyName($paths[0]), '_p1') |
||
29 | ->where('_p1.' . $paths[1] . ' = :value') |
||
30 | ->setParameter('value', $value) |
||
31 | ; |
||
32 | } else { |
||
33 | $queryBuilder |
||
34 | ->where($this->getPropertyName($propertyPath) . ' = :value') |
||
35 | ->setParameter('value', $value) |
||
36 | ; |
||
37 | } |
||
38 | |||
39 | return $queryBuilder |
||
40 | ->getQuery() |
||
41 | ->getOneOrNullResult() |
||
42 | ; |
||
43 | } |
||
44 | |||
57 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: