@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
175 | - * @param $className |
|
175 | + * @param string $className |
|
176 | 176 | * @param \stdClass $data |
177 | 177 | * |
178 | 178 | * @return ObjectManagerAware|object |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * INTERNAL: |
231 | 231 | * Registers an entity as managed. |
232 | 232 | * |
233 | - * @param object $entity The entity. |
|
233 | + * @param Proxy $entity The entity. |
|
234 | 234 | * @param array $id The identifier values. |
235 | 235 | * @param \stdClass|null $data The original entity data. |
236 | 236 | * |
@@ -1740,7 +1740,7 @@ discard block |
||
1740 | 1740 | $class = $this->manager->getClassMetadata(get_class($entity)); |
1741 | 1741 | $associationMappings = array_filter( |
1742 | 1742 | $class->getAssociationMappings(), |
1743 | - function ($assoc) { |
|
1743 | + function($assoc) { |
|
1744 | 1744 | return $assoc['isCascadeRefresh']; |
1745 | 1745 | } |
1746 | 1746 | ); |
@@ -1779,7 +1779,7 @@ discard block |
||
1779 | 1779 | $class = $this->manager->getClassMetadata(get_class($entity)); |
1780 | 1780 | $associationMappings = array_filter( |
1781 | 1781 | $class->getAssociationMappings(), |
1782 | - function ($assoc) { |
|
1782 | + function($assoc) { |
|
1783 | 1783 | return $assoc['isCascadeDetach']; |
1784 | 1784 | } |
1785 | 1785 | ); |
@@ -1819,7 +1819,7 @@ discard block |
||
1819 | 1819 | $class = $this->manager->getClassMetadata(get_class($entity)); |
1820 | 1820 | $associationMappings = array_filter( |
1821 | 1821 | $class->getAssociationMappings(), |
1822 | - function ($assoc) { |
|
1822 | + function($assoc) { |
|
1823 | 1823 | return $assoc['isCascadeMerge']; |
1824 | 1824 | } |
1825 | 1825 | ); |
@@ -1857,11 +1857,11 @@ discard block |
||
1857 | 1857 | $class = $this->manager->getClassMetadata(get_class($entity)); |
1858 | 1858 | $associationMappings = array_filter( |
1859 | 1859 | $class->getAssociationMappings(), |
1860 | - function ($assoc) { |
|
1860 | + function($assoc) { |
|
1861 | 1861 | return $assoc['isCascadeRemove']; |
1862 | 1862 | } |
1863 | 1863 | ); |
1864 | - $entitiesToCascade = []; |
|
1864 | + $entitiesToCascade = []; |
|
1865 | 1865 | foreach ($associationMappings as $assoc) { |
1866 | 1866 | if ($entity instanceof Proxy && !$entity->__isInitialized__) { |
1867 | 1867 | $entity->__load(); |
@@ -50,7 +50,7 @@ |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | - * @param $className |
|
53 | + * @param string $className |
|
54 | 54 | * |
55 | 55 | * @return \ReflectionProperty[] indexed by property internal name |
56 | 56 | */ |
@@ -6,11 +6,17 @@ discard block |
||
6 | 6 | |
7 | 7 | class MappingException extends BaseMappingException implements DoctrineApiException |
8 | 8 | { |
9 | + /** |
|
10 | + * @param string $alias |
|
11 | + */ |
|
9 | 12 | public static function unknownAlias($alias) |
10 | 13 | { |
11 | 14 | return new self(sprintf('Unknown namespace alias "%s"', $alias)); |
12 | 15 | } |
13 | 16 | |
17 | + /** |
|
18 | + * @param string $class |
|
19 | + */ |
|
14 | 20 | public static function noSuchProperty($property, $class) |
15 | 21 | { |
16 | 22 | return new self( |
@@ -20,6 +26,9 @@ discard block |
||
20 | 26 | ); |
21 | 27 | } |
22 | 28 | |
29 | + /** |
|
30 | + * @param string $class |
|
31 | + */ |
|
23 | 32 | public static function noClientSpecified($class) |
24 | 33 | { |
25 | 34 | return new self(sprintf('Client not specified for %s or any parent', $class)); |
@@ -30,6 +39,9 @@ discard block |
||
30 | 39 | return new self(sprintf('Could not resolve client "%s": %s', $name, $message)); |
31 | 40 | } |
32 | 41 | |
42 | + /** |
|
43 | + * @param string $class |
|
44 | + */ |
|
33 | 45 | public static function noApiSpecified($class) |
34 | 46 | { |
35 | 47 | return new self(sprintf('API factory not specified for %s or any parent', $class)); |
@@ -40,11 +52,18 @@ discard block |
||
40 | 52 | return new self(sprintf('Could not resolve API factory "%s": %s', $name, $message)); |
41 | 53 | } |
42 | 54 | |
55 | + /** |
|
56 | + * @param string $class |
|
57 | + */ |
|
43 | 58 | public static function unknownField($field, $class) |
44 | 59 | { |
45 | 60 | return new self(sprintf('No mapping for field "%s" in %s', $field, $class)); |
46 | 61 | } |
47 | 62 | |
63 | + /** |
|
64 | + * @param string $field |
|
65 | + * @param string $class |
|
66 | + */ |
|
48 | 67 | public static function unknownAssociation($field, $class) |
49 | 68 | { |
50 | 69 | return new self(sprintf('No mapping for association "%s" in %s', $field, $class)); |
@@ -65,31 +84,51 @@ discard block |
||
65 | 84 | return new static(sprintf('Unknown factory to create API: %s', $alias)); |
66 | 85 | } |
67 | 86 | |
87 | + /** |
|
88 | + * @param string $alias |
|
89 | + */ |
|
68 | 90 | public static function nameIsMandatoryForDiscriminatorColumns($alias) |
69 | 91 | { |
70 | 92 | return new static(sprintf('Name is mandatory for discriminator column: %s', $alias)); |
71 | 93 | } |
72 | 94 | |
95 | + /** |
|
96 | + * @param string $alias |
|
97 | + */ |
|
73 | 98 | public static function duplicateColumnName($alias, $column) |
74 | 99 | { |
75 | 100 | return new static(sprintf('Duplicate column name "%s": %s', $column, $alias)); |
76 | 101 | } |
77 | 102 | |
103 | + /** |
|
104 | + * @param string $alias |
|
105 | + * @param string $type |
|
106 | + */ |
|
78 | 107 | public static function invalidDiscriminatorColumnType($alias, $type) |
79 | 108 | { |
80 | 109 | return new static(sprintf('Invalud discriminator column type "%s": %s', $type, $alias)); |
81 | 110 | } |
82 | 111 | |
112 | + /** |
|
113 | + * @param string $name |
|
114 | + * @param string $rootEntityName |
|
115 | + */ |
|
83 | 116 | public static function mappedClassNotPartOfDiscriminatorMap($name, $rootEntityName) |
84 | 117 | { |
85 | 118 | return new static(sprintf('Mapped class "%s" is not a part of discriminator map: %s', $name, $rootEntityName)); |
86 | 119 | } |
87 | 120 | |
121 | + /** |
|
122 | + * @param string $alias |
|
123 | + */ |
|
88 | 124 | public static function unknownDiscriminatorValue($value, $alias) |
89 | 125 | { |
90 | 126 | return new static(sprintf('Unknown discriminator value "%s": %s', $value, $alias)); |
91 | 127 | } |
92 | 128 | |
129 | + /** |
|
130 | + * @param string $name |
|
131 | + */ |
|
93 | 132 | public static function duplicateDiscriminatorEntry($name, array $duplicates, array $map) |
94 | 133 | { |
95 | 134 | return new static( |
@@ -97,6 +136,10 @@ discard block |
||
97 | 136 | ); |
98 | 137 | } |
99 | 138 | |
139 | + /** |
|
140 | + * @param string $className |
|
141 | + * @param string $name |
|
142 | + */ |
|
100 | 143 | public static function invalidClassInDiscriminatorMap($className, $name) |
101 | 144 | { |
102 | 145 | return new static( |
@@ -38,7 +38,7 @@ |
||
38 | 38 | private $factoryRegistry; |
39 | 39 | |
40 | 40 | /** |
41 | - * @return mixed |
|
41 | + * @return ClientRegistryInterface |
|
42 | 42 | */ |
43 | 43 | public function getClientRegistry() |
44 | 44 | { |
@@ -13,14 +13,12 @@ |
||
13 | 13 | use Bankiru\Api\Doctrine\EntityManager; |
14 | 14 | use Bankiru\Api\Doctrine\EntityMetadataFactory; |
15 | 15 | use Bankiru\Api\Doctrine\Mapping\Driver\YmlMetadataDriver; |
16 | -use Bankiru\Api\Doctrine\Test\TestApiFactory; |
|
17 | 16 | use Bankiru\Api\Doctrine\Type\BaseTypeRegistry; |
18 | 17 | use Bankiru\Api\Doctrine\Type\TypeRegistry; |
19 | 18 | use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain; |
20 | 19 | use Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator; |
21 | 20 | use PHPUnit\Framework\TestCase; |
22 | 21 | use ScayTrase\Api\Rpc\Test\RpcMockClient; |
23 | -use ScayTrase\Api\Rpc\Tests\AbstractRpcTest; |
|
24 | 22 | use ScayTrase\Api\Rpc\Tests\RpcRequestTrait; |
25 | 23 | |
26 | 24 | abstract class AbstractEntityManagerTest extends TestCase |
@@ -120,14 +120,14 @@ |
||
120 | 120 | $configuration->setClientRegistry($this->clientRegistry); |
121 | 121 | $configuration->setTypeRegistry(new BaseTypeRegistry(new TypeRegistry())); |
122 | 122 | $configuration->setFactoryRegistry($this->factoryRegistry); |
123 | - $configuration->setProxyDir(CACHE_DIR.'/doctrine/proxy/'); |
|
123 | + $configuration->setProxyDir(CACHE_DIR . '/doctrine/proxy/'); |
|
124 | 124 | $configuration->setProxyNamespace('Bankiru\Api\Doctrine\Test\Proxy'); |
125 | 125 | $driver = new MappingDriverChain(); |
126 | 126 | $driver->addDriver( |
127 | 127 | new YmlMetadataDriver( |
128 | 128 | new SymfonyFileLocator( |
129 | 129 | [ |
130 | - __DIR__.'/../Test/Resources/config/api/' => 'Bankiru\Api\Doctrine\Test\Entity', |
|
130 | + __DIR__ . '/../Test/Resources/config/api/' => 'Bankiru\Api\Doctrine\Test\Entity', |
|
131 | 131 | ], |
132 | 132 | '.api.yml', |
133 | 133 | DIRECTORY_SEPARATOR |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | $this->getClient()->push( |
13 | 13 | $this->getResponseMock(true, 5), |
14 | - function (RpcRequestInterface $request) { |
|
14 | + function(RpcRequestInterface $request) { |
|
15 | 15 | self::assertEquals('prefixed-entity/count', $request->getMethod()); |
16 | 16 | self::assertEquals( |
17 | 17 | [ |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ], |
66 | 66 | ] |
67 | 67 | ), |
68 | - function (RpcRequestInterface $request) { |
|
68 | + function(RpcRequestInterface $request) { |
|
69 | 69 | self::assertEquals('discriminator/search', $request->getMethod()); |
70 | 70 | self::assertEquals( |
71 | 71 | [ |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | ], |
135 | 135 | ] |
136 | 136 | ), |
137 | - function (RpcRequestInterface $request) { |
|
137 | + function(RpcRequestInterface $request) { |
|
138 | 138 | self::assertEquals('discriminator/search', $request->getMethod()); |
139 | 139 | self::assertEquals( |
140 | 140 | [ |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | { |
178 | 178 | $this->getClient()->push( |
179 | 179 | $this->getResponseMock(true, ['id_field' => 241]), |
180 | - function (RpcRequestInterface $request) { |
|
180 | + function(RpcRequestInterface $request) { |
|
181 | 181 | self::assertEquals('discriminator/create', $request->getMethod()); |
182 | 182 | self::assertEquals( |
183 | 183 | [ |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | $this->getClient()->push( |
201 | 201 | $this->getResponseMock(true, ['id_field' => 241]), |
202 | - function (RpcRequestInterface $request) { |
|
202 | + function(RpcRequestInterface $request) { |
|
203 | 203 | self::assertEquals('discriminator/patch', $request->getMethod()); |
204 | 204 | self::assertEquals( |
205 | 205 | [ |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | $this->getClient('test-reference-client')->push( |
16 | 16 | $this->getResponseMock(true, 241), |
17 | - function (RpcRequestInterface $request) { |
|
17 | + function(RpcRequestInterface $request) { |
|
18 | 18 | self::assertEquals('test-reference/create', $request->getMethod()); |
19 | 19 | self::assertEquals( |
20 | 20 | [ |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | $this->getClient('test-reference-client')->push( |
43 | 43 | $this->getResponseMock(true, ['id' => 241]), |
44 | - function (RpcRequestInterface $request) { |
|
44 | + function(RpcRequestInterface $request) { |
|
45 | 45 | self::assertEquals('test-reference/create', $request->getMethod()); |
46 | 46 | self::assertEquals( |
47 | 47 | [ |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | $this->getClient()->push( |
72 | 72 | $this->getResponseMock(true, (object)['id' => 42]), |
73 | - function (RpcRequestInterface $request) { |
|
73 | + function(RpcRequestInterface $request) { |
|
74 | 74 | self::assertEquals('test-entity/create', $request->getMethod()); |
75 | 75 | self::assertEquals( |
76 | 76 | [ |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $this->getClient('test-reference-client')->push( |
88 | 88 | $this->getResponseMock(true, (object)['id' => 241]), |
89 | - function (RpcRequestInterface $request) { |
|
89 | + function(RpcRequestInterface $request) { |
|
90 | 90 | self::assertEquals('test-reference/create', $request->getMethod()); |
91 | 91 | self::assertEquals( |
92 | 92 | [ |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $newParent = new TestEntity(); |
124 | 124 | $this->getClient()->push( |
125 | 125 | $this->getResponseMock(true, (object)['id' => 17]), |
126 | - function (RpcRequestInterface $request) { |
|
126 | + function(RpcRequestInterface $request) { |
|
127 | 127 | self::assertEquals('test-entity/create', $request->getMethod()); |
128 | 128 | self::assertEquals( |
129 | 129 | [ |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | ); |
139 | 139 | $this->getClient('test-reference-client')->push( |
140 | 140 | $this->getResponseMock(true, null), |
141 | - function (RpcRequestInterface $request) { |
|
141 | + function(RpcRequestInterface $request) { |
|
142 | 142 | self::assertEquals('test-reference/patch', $request->getMethod()); |
143 | 143 | self::assertEquals( |
144 | 144 | [ |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | /** @var EntityMetadata $target */ |
45 | 45 | $target = $this->manager->getClassMetadata($mapping['target']); |
46 | 46 | |
47 | - $converter = function ($value) use ($target) { |
|
47 | + $converter = function($value) use ($target) { |
|
48 | 48 | if (!is_object($value)) { |
49 | 49 | return $value; |
50 | 50 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $values = $converter($values); |
71 | 71 | } |
72 | 72 | } else { |
73 | - $caster = function ($value) use ($field) { |
|
73 | + $caster = function($value) use ($field) { |
|
74 | 74 | $type = $this->manager |
75 | 75 | ->getConfiguration() |
76 | 76 | ->getTypeRegistry()->get($this->metadata->getTypeOfField($field)); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | ], |
188 | 188 | ] |
189 | 189 | ), |
190 | - function (RpcRequestInterface $request) { |
|
190 | + function(RpcRequestInterface $request) { |
|
191 | 191 | self::assertNull($request->getParameters()['criteria']['parent']); |
192 | 192 | |
193 | 193 | return true; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | ], |
209 | 209 | ] |
210 | 210 | ), |
211 | - function (RpcRequestInterface $request) { |
|
211 | + function(RpcRequestInterface $request) { |
|
212 | 212 | self::assertNull($request->getParameters()['criteria']['payload']); |
213 | 213 | |
214 | 214 | return true; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | 'sub-payload' => 'sub-payload', |
233 | 233 | ] |
234 | 234 | ), |
235 | - function (RpcRequestInterface $request) { |
|
235 | + function(RpcRequestInterface $request) { |
|
236 | 236 | self::assertEquals('test-entity/find', $request->getMethod()); |
237 | 237 | self::assertEquals(['id' => 1], $request->getParameters()); |
238 | 238 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | ], |
257 | 257 | ] |
258 | 258 | ), |
259 | - function (RpcRequestInterface $request) { |
|
259 | + function(RpcRequestInterface $request) { |
|
260 | 260 | self::assertEquals('test-reference/search', $request->getMethod()); |
261 | 261 | self::assertEquals( |
262 | 262 | [ |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | 'owner' => null, |
301 | 301 | ] |
302 | 302 | ), |
303 | - function (RpcRequestInterface $request) { |
|
303 | + function(RpcRequestInterface $request) { |
|
304 | 304 | self::assertEquals('test-reference/find', $request->getMethod()); |
305 | 305 | self::assertEquals(['id' => 1], $request->getParameters()); |
306 | 306 |