@@ -115,6 +115,9 @@ discard block |
||
115 | 115 | return array_shift($identifier); |
116 | 116 | } |
117 | 117 | |
118 | + /** |
|
119 | + * @param string $attribute |
|
120 | + */ |
|
118 | 121 | private function getObjectMetadata($object, $attribute) |
119 | 122 | { |
120 | 123 | $class = get_class($object); |
@@ -132,6 +135,9 @@ discard block |
||
132 | 135 | return $metadata; |
133 | 136 | } |
134 | 137 | |
138 | + /** |
|
139 | + * @param string $attribute |
|
140 | + */ |
|
135 | 141 | private function getAssocMetadata(ClassMetadataInterface $metadata, $attribute) |
136 | 142 | { |
137 | 143 | $assoc = $metadata->getAssociationTargetClass($attribute); |
@@ -139,9 +139,9 @@ |
||
139 | 139 | |
140 | 140 | if (null === $assocManager) { |
141 | 141 | throw new \LogicException($metadata->getName() . |
142 | - '::$' . |
|
143 | - $attribute . |
|
144 | - ' references non-existent managed entity'); |
|
142 | + '::$' . |
|
143 | + $attribute . |
|
144 | + ' references non-existent managed entity'); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | return $assocManager->getClassMetadata($assoc); |
@@ -138,9 +138,9 @@ |
||
138 | 138 | $assocManager = $this->registry->getManagerForClass($assoc); |
139 | 139 | |
140 | 140 | if (null === $assocManager) { |
141 | - throw new \LogicException($metadata->getName() . |
|
142 | - '::$' . |
|
143 | - $attribute . |
|
141 | + throw new \LogicException($metadata->getName(). |
|
142 | + '::$'. |
|
143 | + $attribute. |
|
144 | 144 | ' references non-existent managed entity'); |
145 | 145 | } |
146 | 146 |
@@ -9,7 +9,6 @@ |
||
9 | 9 | use ScayTrase\Api\Cruds\Controller\ReadController; |
10 | 10 | use ScayTrase\Api\Cruds\Controller\SearchController; |
11 | 11 | use ScayTrase\Api\Cruds\Controller\UpdateController; |
12 | -use ScayTrase\Api\Cruds\PropertyAccessProcessor; |
|
13 | 12 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
14 | 13 | use Symfony\Component\DependencyInjection\Definition; |
15 | 14 | use Symfony\Component\DependencyInjection\DefinitionDecorator; |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | $actionConfig['name'] = $name; |
55 | 55 | $actionConfig['class'] = $class; |
56 | 56 | $actionConfig['repository'] = $repositoryDefinition; |
57 | - $actionConfig['path'] = $prefix . $actionConfig['path']; |
|
57 | + $actionConfig['path'] = $prefix.$actionConfig['path']; |
|
58 | 58 | $actionConfig['manager'] = $manager; |
59 | - $function = new \ReflectionMethod($this, 'register' . ucfirst($action) . 'Action'); |
|
59 | + $function = new \ReflectionMethod($this, 'register'.ucfirst($action).'Action'); |
|
60 | 60 | $args = []; |
61 | 61 | |
62 | 62 | foreach ($function->getParameters() as $parameter) { |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | ); |
97 | 97 | $definition->setPublic(true); |
98 | 98 | |
99 | - $controllerId = $this->normalize('cruds.api.generated.' . $name . '.create_controller'); |
|
99 | + $controllerId = $this->normalize('cruds.api.generated.'.$name.'.create_controller'); |
|
100 | 100 | $this->container->setDefinition($controllerId, $definition); |
101 | 101 | |
102 | 102 | $this->getLoaderDefinition()->addMethodCall( |
103 | 103 | 'addRoute', |
104 | 104 | [ |
105 | - $this->normalize('cruds_api_' . $name . '_create'), |
|
105 | + $this->normalize('cruds_api_'.$name.'_create'), |
|
106 | 106 | $path, |
107 | - $controllerId . ':' . CreateController::ACTION, |
|
107 | + $controllerId.':'.CreateController::ACTION, |
|
108 | 108 | ['POST'], |
109 | 109 | ] |
110 | 110 | ); |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | ] |
121 | 121 | ); |
122 | 122 | |
123 | - $controllerId = $this->normalize('cruds_api_' . $name . '_read_controller'); |
|
123 | + $controllerId = $this->normalize('cruds_api_'.$name.'_read_controller'); |
|
124 | 124 | $this->container->setDefinition($controllerId, $definition); |
125 | 125 | |
126 | 126 | $this->getLoaderDefinition()->addMethodCall( |
127 | 127 | 'addRoute', |
128 | 128 | [ |
129 | - $this->normalize('cruds_api_' . $name . '_read'), |
|
129 | + $this->normalize('cruds_api_'.$name.'_read'), |
|
130 | 130 | $path, |
131 | - $controllerId . ':' . ReadController::ACTION, |
|
131 | + $controllerId.':'.ReadController::ACTION, |
|
132 | 132 | ['GET'], |
133 | 133 | ] |
134 | 134 | ); |
@@ -152,15 +152,15 @@ discard block |
||
152 | 152 | ] |
153 | 153 | ); |
154 | 154 | |
155 | - $controllerId = $this->normalize('cruds_api_' . $name . '_update_controller'); |
|
155 | + $controllerId = $this->normalize('cruds_api_'.$name.'_update_controller'); |
|
156 | 156 | $this->container->setDefinition($controllerId, $definition); |
157 | 157 | |
158 | 158 | $this->getLoaderDefinition()->addMethodCall( |
159 | 159 | 'addRoute', |
160 | 160 | [ |
161 | - $this->normalize('cruds_api_' . $name . '_update'), |
|
161 | + $this->normalize('cruds_api_'.$name.'_update'), |
|
162 | 162 | $path, |
163 | - $controllerId . ':' . UpdateController::ACTION, |
|
163 | + $controllerId.':'.UpdateController::ACTION, |
|
164 | 164 | ['POST'], |
165 | 165 | ] |
166 | 166 | ); |
@@ -177,15 +177,15 @@ discard block |
||
177 | 177 | ] |
178 | 178 | ); |
179 | 179 | |
180 | - $controllerId = $this->normalize('cruds_api_' . $name . '_delete_controller'); |
|
180 | + $controllerId = $this->normalize('cruds_api_'.$name.'_delete_controller'); |
|
181 | 181 | $this->container->setDefinition($controllerId, $definition); |
182 | 182 | |
183 | 183 | $this->getLoaderDefinition()->addMethodCall( |
184 | 184 | 'addRoute', |
185 | 185 | [ |
186 | - $this->normalize('cruds_api_' . $name . '_delete'), |
|
186 | + $this->normalize('cruds_api_'.$name.'_delete'), |
|
187 | 187 | $path, |
188 | - $controllerId . ':' . DeleteController::ACTION, |
|
188 | + $controllerId.':'.DeleteController::ACTION, |
|
189 | 189 | ['POST'], |
190 | 190 | ] |
191 | 191 | ); |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | ] |
209 | 209 | ); |
210 | 210 | |
211 | - $controllerId = $this->normalize('cruds_api_' . $name . '_search_controller'); |
|
211 | + $controllerId = $this->normalize('cruds_api_'.$name.'_search_controller'); |
|
212 | 212 | $this->container->setDefinition($controllerId, $definition); |
213 | 213 | |
214 | 214 | $this->getLoaderDefinition()->addMethodCall( |
215 | 215 | 'addRoute', |
216 | 216 | [ |
217 | - $this->normalize('cruds_api_' . $name . '_search'), |
|
217 | + $this->normalize('cruds_api_'.$name.'_search'), |
|
218 | 218 | $path, |
219 | - $controllerId . ':' . SearchController::ACTION, |
|
219 | + $controllerId.':'.SearchController::ACTION, |
|
220 | 220 | ['GET', 'POST'], |
221 | 221 | ] |
222 | 222 | ); |
@@ -23,18 +23,18 @@ |
||
23 | 23 | |
24 | 24 | public function getCacheDir() |
25 | 25 | { |
26 | - return __DIR__ . '/../../../build/' . $this->getClassName() . '/cache'; |
|
26 | + return __DIR__.'/../../../build/'.$this->getClassName().'/cache'; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function getLogDir() |
30 | 30 | { |
31 | - return __DIR__ . '/../../../build/' . $this->getClassName() . '/logs'; |
|
31 | + return __DIR__.'/../../../build/'.$this->getClassName().'/logs'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** {@inheritdoc} */ |
35 | 35 | public function registerContainerConfiguration(LoaderInterface $loader) |
36 | 36 | { |
37 | - return $loader->load(__DIR__ . '/config.yml'); |
|
37 | + return $loader->load(__DIR__.'/config.yml'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $handler->setArguments([new Reference('doctrine')]); |
34 | 34 | |
35 | 35 | $container->getDefinition('serializer.normalizer.object') |
36 | - ->addMethodCall('setCircularReferenceHandler', [[$handler, 'handle']]); |
|
36 | + ->addMethodCall('setCircularReferenceHandler', [[$handler, 'handle']]); |
|
37 | 37 | |
38 | 38 | $normalizer = new DefinitionDecorator('serializer.normalizer.object'); |
39 | 39 | $normalizer->setClass(DoctrineObjectNormalizer::class); |
@@ -21,7 +21,7 @@ |
||
21 | 21 | return; |
22 | 22 | } |
23 | 23 | |
24 | - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../../Resources/config')); |
|
24 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../../Resources/config')); |
|
25 | 25 | $loader->load('doctrine.yml'); |
26 | 26 | |
27 | 27 | $factory = $container->getDefinition('cruds.factory.reflection'); |