@@ -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\Collections; |
6 | 6 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return $this->walkComposite($expr); |
46 | 46 | } |
47 | 47 | |
48 | - throw new \RuntimeException('Unknown Expression: ' . get_class($expr)); |
|
48 | + throw new \RuntimeException('Unknown Expression: '.get_class($expr)); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | } |
97 | 97 | |
98 | - throw new \RuntimeException('Unknown comparator: ' . $comparison->getComparator()); |
|
98 | + throw new \RuntimeException('Unknown comparator: '.$comparison->getComparator()); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $ormExpressions[] = $this->dispatch($childExpression); |
111 | 111 | } |
112 | 112 | |
113 | - $method = $expression->getType() == Composite::AND ? 'andX' : 'orX'; |
|
113 | + $method = $expression->getType() == Composite::AND? 'andX' : 'orX'; |
|
114 | 114 | |
115 | 115 | return call_user_func_array([$this->expressionBuilder, $method], $ormExpressions); |
116 | 116 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | { |
24 | 24 | throw new self(sprintf( |
25 | 25 | 'Comparison "%s" is not supported.', |
26 | - $comparison |
|
26 | + $comparison |
|
27 | 27 | )); |
28 | 28 | } |
29 | 29 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | [ |
107 | 107 | 'null', |
108 | 108 | null, |
109 | - function ($expr) { |
|
109 | + function($expr) { |
|
110 | 110 | $this->assertEquals('=', $expr->getOperator()); |
111 | 111 | $this->assertNull($expr->getValue()->getValue()); |
112 | 112 | }, |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | [ |
115 | 115 | 'in', |
116 | 116 | [1, 2, 3], |
117 | - function ($expr) { |
|
117 | + function($expr) { |
|
118 | 118 | $this->assertEquals('IN', $expr->getOperator()); |
119 | 119 | $this->assertEquals([1, 2, 3], $expr->getValue()->getValue()); |
120 | 120 | }, |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | [ |
123 | 123 | 'nin', |
124 | 124 | [1, 2, 3], |
125 | - function ($expr) { |
|
125 | + function($expr) { |
|
126 | 126 | $this->assertEquals('NIN', $expr->getOperator()); |
127 | 127 | $this->assertEquals([1, 2, 3], $expr->getValue()->getValue()); |
128 | 128 | }, |
@@ -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\Collections; |
6 | 6 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public function addCollection($classFqn, array $collection) |
21 | 21 | { |
22 | - array_map(function ($object) use ($classFqn) { |
|
22 | + array_map(function($object) use ($classFqn) { |
|
23 | 23 | if (get_class($object) !== $classFqn) { |
24 | 24 | throw new \InvalidArgumentException(sprintf( |
25 | 25 | 'All objects in collection must be of class "%s", got "%s"', |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Psi\Bridge\ObjectAgent\Doctrine\PhpcrOdm; |
6 | 6 |
@@ -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\PhpcrOdm; |
6 | 6 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $orderBy = $queryBuilder->orderBy(); |
134 | 134 | foreach ($query->getOrderings() as $field => $order) { |
135 | 135 | $order = strtolower($order); |
136 | - $orderBy->{$order}()->field($sourceAlias . '.' . $field); |
|
136 | + $orderBy->{$order}()->field($sourceAlias.'.'.$field); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | if (null !== $query->getFirstResult()) { |
@@ -59,7 +59,7 @@ |
||
59 | 59 | |
60 | 60 | $page = new Page(); |
61 | 61 | $page->title = $title; |
62 | - $page->path = '/test/page-' . $id++; |
|
62 | + $page->path = '/test/page-'.$id++; |
|
63 | 63 | $this->documentManager->persist($page); |
64 | 64 | $this->documentManager->flush(); |
65 | 65 |
@@ -9,8 +9,6 @@ discard block |
||
9 | 9 | use Doctrine\Common\Util\ClassUtils; |
10 | 10 | use Doctrine\ORM\EntityManagerInterface; |
11 | 11 | use Doctrine\ORM\QueryBuilder; |
12 | -use Doctrine\ORM\Query as OrmQuery; |
|
13 | -use Doctrine\ORM\Tools\Pagination\Paginator; |
|
14 | 12 | use Psi\Component\ObjectAgent\AgentInterface; |
15 | 13 | use Psi\Component\ObjectAgent\Capabilities; |
16 | 14 | use Psi\Component\ObjectAgent\Exception\BadMethodCallException; |
@@ -18,7 +16,6 @@ discard block |
||
18 | 16 | use Psi\Component\ObjectAgent\Query\Comparison; |
19 | 17 | use Psi\Component\ObjectAgent\Query\Query; |
20 | 18 | use Psi\Component\ObjectAgent\Query\Join; |
21 | -use Doctrine\ORM\Query\Expr\Select; |
|
22 | 19 | |
23 | 20 | class OrmAgent implements AgentInterface |
24 | 21 | { |
@@ -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 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $idField = reset($idFields); |
104 | 104 | |
105 | 105 | $queryBuilder = $this->entityManager->getRepository($class)->createQueryBuilder('a'); |
106 | - $queryBuilder->where($queryBuilder->expr()->in('a.' . $idField, ':identifiers')); |
|
106 | + $queryBuilder->where($queryBuilder->expr()->in('a.'.$idField, ':identifiers')); |
|
107 | 107 | $queryBuilder->setParameter('identifiers', $identifiers); |
108 | 108 | |
109 | 109 | return $queryBuilder->getQuery()->execute(); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | // TODO: Make a clone method on the Query, which allows passing an |
206 | 206 | // array of parts to replace in the clone. |
207 | 207 | $query = Query::create($query->getClassFqn(), [ |
208 | - 'selects' => [ 'count(' . self::SOURCE_ALIAS . '.' . $idField . ')' ], |
|
208 | + 'selects' => ['count('.self::SOURCE_ALIAS.'.'.$idField.')'], |
|
209 | 209 | 'joins' => $query->getJoins(), |
210 | 210 | 'criteria' => $query->hasExpression() ? $query->getExpression() : null, |
211 | 211 | ]); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | |
246 | 246 | $selects = []; |
247 | 247 | foreach ($query->getSelects() as $selectName => $selectAlias) { |
248 | - $select = $selectName . ' ' . $selectAlias; |
|
248 | + $select = $selectName.' '.$selectAlias; |
|
249 | 249 | if (is_int($selectName)) { |
250 | 250 | $select = $selectAlias; |
251 | 251 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | foreach ($query->getOrderings() as $field => $order) { |
271 | - $queryBuilder->addOrderBy(self::SOURCE_ALIAS . '.' . $field, $order); |
|
271 | + $queryBuilder->addOrderBy(self::SOURCE_ALIAS.'.'.$field, $order); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | if (null !== $query->getFirstResult()) { |
@@ -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); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | $this->joins = $joins; |
32 | 32 | $this->selects = $selects; |
33 | 33 | |
34 | - array_walk($joins, function (Join $join) { |
|
34 | + array_walk($joins, function(Join $join) { |
|
35 | 35 | }); |
36 | 36 | } |
37 | 37 |