@@ -60,6 +60,9 @@ |
||
60 | 60 | return new self($classFqn, $query['selects'], $query['joins'], $query['criteria'], $query['orderings'], $query['firstResult'], $query['maxResults']); |
61 | 61 | } |
62 | 62 | |
63 | + /** |
|
64 | + * @param string $value1 |
|
65 | + */ |
|
63 | 66 | public static function comparison(string $comparator, $value1, $value2): Comparison |
64 | 67 | { |
65 | 68 | return new Comparison($comparator, $value1, $value2); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Psi\Component\ObjectAgent\Query; |
6 | 6 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->joins = $joins; |
34 | 34 | $this->selects = $selects; |
35 | 35 | |
36 | - array_walk($joins, function (Join $join) { |
|
36 | + array_walk($joins, function(Join $join) { |
|
37 | 37 | }); |
38 | 38 | } |
39 | 39 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Psi\Bridge\ObjectAgent\Doctrine\Orm; |
6 | 6 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | return $this->walkComposite($expr); |
38 | 38 | } |
39 | 39 | |
40 | - throw new \RuntimeException('Unknown Expression: ' . get_class($expr)); |
|
40 | + throw new \RuntimeException('Unknown Expression: '.get_class($expr)); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function getParameters() |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | return $this->expressionFactory->isNotNull($this->getField($field), $this->registerParameter($field, $value)); |
89 | 89 | } |
90 | 90 | |
91 | - throw new \RuntimeException('Unknown comparator: ' . $comparison->getComparator()); |
|
91 | + throw new \RuntimeException('Unknown comparator: '.$comparison->getComparator()); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | private function walkComposite(Composite $expression) |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $ormExpressions[] = $this->dispatch($childExpression); |
101 | 101 | } |
102 | 102 | |
103 | - $method = $expression->getType() == Composite::AND ? 'andX' : 'orX'; |
|
103 | + $method = $expression->getType() == Composite::AND? 'andX' : 'orX'; |
|
104 | 104 | |
105 | 105 | return call_user_func_array([$this->expressionFactory, $method], $ormExpressions); |
106 | 106 | } |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | // otherwise use the primary source alias. |
116 | - return $this->sourceAlias . '.' . $field; |
|
116 | + return $this->sourceAlias.'.'.$field; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | private function registerParameter(string $name, $value) |
120 | 120 | { |
121 | - $name = 'param' . $this->paramIndex++; |
|
121 | + $name = 'param'.$this->paramIndex++; |
|
122 | 122 | $this->parameters[$name] = $value; |
123 | 123 | |
124 | - return ':' . $name; |
|
124 | + return ':'.$name; |
|
125 | 125 | } |
126 | 126 | } |
@@ -8,7 +8,6 @@ |
||
8 | 8 | use Doctrine\Common\Persistence\Mapping\MappingException; |
9 | 9 | use Doctrine\Common\Util\ClassUtils; |
10 | 10 | use Doctrine\ORM\EntityManagerInterface; |
11 | -use Doctrine\ORM\Query\Expr\Select; |
|
12 | 11 | use Doctrine\ORM\QueryBuilder; |
13 | 12 | use Psi\Component\ObjectAgent\AgentInterface; |
14 | 13 | use Psi\Component\ObjectAgent\Capabilities; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Psi\Bridge\ObjectAgent\Doctrine\Orm; |
6 | 6 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $idField = reset($idFields); |
102 | 102 | |
103 | 103 | $queryBuilder = $this->entityManager->getRepository($class)->createQueryBuilder('a'); |
104 | - $queryBuilder->where($queryBuilder->expr()->in('a.' . $idField, ':identifiers')); |
|
104 | + $queryBuilder->where($queryBuilder->expr()->in('a.'.$idField, ':identifiers')); |
|
105 | 105 | $queryBuilder->setParameter('identifiers', $identifiers); |
106 | 106 | |
107 | 107 | return $queryBuilder->getQuery()->execute(); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | // TODO: Make a clone method on the Query, which allows passing an |
204 | 204 | // array of parts to replace in the clone. |
205 | 205 | $query = Query::create($query->getClassFqn(), [ |
206 | - 'selects' => ['count(' . self::SOURCE_ALIAS . '.' . $idField . ')'], |
|
206 | + 'selects' => ['count('.self::SOURCE_ALIAS.'.'.$idField.')'], |
|
207 | 207 | 'joins' => $query->getJoins(), |
208 | 208 | 'criteria' => $query->hasExpression() ? $query->getExpression() : null, |
209 | 209 | ]); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | $selects = []; |
245 | 245 | foreach ($query->getSelects() as $selectName => $selectAlias) { |
246 | - $select = $selectName . ' ' . $selectAlias; |
|
246 | + $select = $selectName.' '.$selectAlias; |
|
247 | 247 | if (is_int($selectName)) { |
248 | 248 | $select = $selectAlias; |
249 | 249 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | } |
267 | 267 | |
268 | 268 | foreach ($query->getOrderings() as $field => $order) { |
269 | - $queryBuilder->addOrderBy(self::SOURCE_ALIAS . '.' . $field, $order); |
|
269 | + $queryBuilder->addOrderBy(self::SOURCE_ALIAS.'.'.$field, $order); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | if (null !== $query->getFirstResult()) { |