@@ -221,6 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | 223 | * Tries to generate forms if they don't exist yet and if we need write operations on entities. |
| 224 | + * @param string $entity |
|
| 224 | 225 | */ |
| 225 | 226 | protected function generateSerializationConfig($bundle, $entity, $metadata, $forceOverwrite) |
| 226 | 227 | { |
@@ -235,6 +236,7 @@ discard block |
||
| 235 | 236 | |
| 236 | 237 | /** |
| 237 | 238 | * Tries to generate forms if they don't exist yet and if we need write operations on entities. |
| 239 | + * @param string $entity |
|
| 238 | 240 | */ |
| 239 | 241 | protected function generateForm($bundle, $entity, $metadata, $forceOverwrite) |
| 240 | 242 | { |
@@ -247,6 +249,9 @@ discard block |
||
| 247 | 249 | return true; |
| 248 | 250 | } |
| 249 | 251 | |
| 252 | + /** |
|
| 253 | + * @param string $entity |
|
| 254 | + */ |
|
| 250 | 255 | protected function generateManager($bundle, $entity, $forceOverwrite) |
| 251 | 256 | { |
| 252 | 257 | try { |
@@ -258,6 +263,9 @@ discard block |
||
| 258 | 263 | return true; |
| 259 | 264 | } |
| 260 | 265 | |
| 266 | + /** |
|
| 267 | + * @param string $entity |
|
| 268 | + */ |
|
| 261 | 269 | protected function generateRepository($bundle, $entity, $forceOverwrite) |
| 262 | 270 | { |
| 263 | 271 | try { |
@@ -269,6 +277,9 @@ discard block |
||
| 269 | 277 | return true; |
| 270 | 278 | } |
| 271 | 279 | |
| 280 | + /** |
|
| 281 | + * @param string $entity |
|
| 282 | + */ |
|
| 272 | 283 | protected function updateRestRouting(QuestionHelper $questionHelper, InputInterface $input, OutputInterface $output, BundleInterface $bundle, $entity, $metadata) |
| 273 | 284 | { |
| 274 | 285 | $output->write('Importing REST config: '); |
@@ -277,6 +288,10 @@ discard block |
||
| 277 | 288 | $config->addResource($bundle->getNamespace(), $entity, $metadata); |
| 278 | 289 | } |
| 279 | 290 | |
| 291 | + /** |
|
| 292 | + * @param string $format |
|
| 293 | + * @param string $entity |
|
| 294 | + */ |
|
| 280 | 295 | protected function updateRouting(QuestionHelper $questionHelper, InputInterface $input, OutputInterface $output, BundleInterface $bundle, $format, $entity, $prefix) |
| 281 | 296 | { |
| 282 | 297 | $auto = true; |
@@ -310,6 +325,9 @@ discard block |
||
| 310 | 325 | } |
| 311 | 326 | } |
| 312 | 327 | |
| 328 | + /** |
|
| 329 | + * @param string $entity |
|
| 330 | + */ |
|
| 313 | 331 | protected function getRoutePrefix(InputInterface $input, $entity) |
| 314 | 332 | { |
| 315 | 333 | $prefix = $input->getOption('route-prefix') ?: strtolower(str_replace(array('\\', '/'), '_', $entity)); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * @param BundleInterface $bundle |
| 26 | 26 | * |
| 27 | - * @return array |
|
| 27 | + * @return string[] |
|
| 28 | 28 | */ |
| 29 | 29 | protected function getSkeletonDirs(BundleInterface $bundle = null) |
| 30 | 30 | { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * @param $shortcut |
| 59 | 59 | * |
| 60 | - * @return array |
|
| 60 | + * @return string[] |
|
| 61 | 61 | */ |
| 62 | 62 | protected function parseShortcutNotation($shortcut) |
| 63 | 63 | { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | - * @param $entity |
|
| 77 | + * @param string $entity |
|
| 78 | 78 | * |
| 79 | 79 | * @return array |
| 80 | 80 | */ |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * @param Request $request |
| 250 | 250 | * @param int $id |
| 251 | 251 | * |
| 252 | - * @return FormInterface |
|
| 252 | + * @return Response |
|
| 253 | 253 | */ |
| 254 | 254 | protected function editForm(Request $request, $id) |
| 255 | 255 | { |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * Apply serialization rules on response object. |
| 296 | 296 | * |
| 297 | 297 | * @param object $result |
| 298 | - * @param array $groups |
|
| 298 | + * @param string[] $groups |
|
| 299 | 299 | * @param int $statusCode |
| 300 | 300 | * |
| 301 | 301 | * @return Response |
@@ -11,6 +11,9 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | abstract class RequestAwareEventListener |
| 13 | 13 | { |
| 14 | + /** |
|
| 15 | + * @return string |
|
| 16 | + */ |
|
| 14 | 17 | protected function getControllerMethod(Request $request) |
| 15 | 18 | { |
| 16 | 19 | $controller = $request->attributes->get('_controller'); |
@@ -122,6 +122,9 @@ |
||
| 122 | 122 | )); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | + /** |
|
| 126 | + * @param boolean $forceOverwrite |
|
| 127 | + */ |
|
| 125 | 128 | protected function canWriteToFile($file, $forceOverwrite) |
| 126 | 129 | { |
| 127 | 130 | return !file_exists($file) || $forceOverwrite; |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | */ |
| 114 | 114 | protected function generateTestClass() |
| 115 | 115 | { |
| 116 | - $target = $this->helper->getTestsDirname() . '/Controller/' . $this->helper->getControllerClass() . 'Test.php'; |
|
| 116 | + $target = $this->helper->getTestsDirname().'/Controller/'.$this->helper->getControllerClass().'Test.php'; |
|
| 117 | 117 | |
| 118 | 118 | $this->renderFile('controller/controller-test.php.twig', $target, array( |
| 119 | 119 | 'entity' => $this->entity, |
@@ -18,6 +18,9 @@ |
||
| 18 | 18 | $this->helper = new BundleStructureHelper($bundle, $entity); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param boolean $forceOverwrite |
|
| 23 | + */ |
|
| 21 | 24 | protected function canWriteToFile($forceOverwrite) |
| 22 | 25 | { |
| 23 | 26 | return !file_exists($this->helper->getManagerFullFilename()) || $forceOverwrite; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | if (!$this->canWriteToFile($forceOverwrite)) { |
| 34 | 34 | throw new \RuntimeException(sprintf( |
| 35 | 35 | 'Unable to generate the %s manager class as it already exists under the file: %s', |
| 36 | - $this->helper->getEntityClass() . 'Type', |
|
| 36 | + $this->helper->getEntityClass().'Type', |
|
| 37 | 37 | $this->helper->getManagerFullFilename() |
| 38 | 38 | )); |
| 39 | 39 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $this->renderFile( |
| 52 | 52 | 'manager/interface.php.twig', |
| 53 | - $this->helper->getManagerFullFilename($this->helper->getManagerClass() . 'Interface.php'), |
|
| 53 | + $this->helper->getManagerFullFilename($this->helper->getManagerClass().'Interface.php'), |
|
| 54 | 54 | [ |
| 55 | 55 | 'bundle_namespace' => $this->helper->getBundleNamespace(), |
| 56 | 56 | 'entity_class' => $this->helper->getEntityClass(), |
@@ -18,6 +18,9 @@ |
||
| 18 | 18 | $this->helper = new BundleStructureHelper($bundle, $entity); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param boolean $forceOverwrite |
|
| 23 | + */ |
|
| 21 | 24 | protected function canWriteToFile($forceOverwrite) |
| 22 | 25 | { |
| 23 | 26 | return !file_exists($this->helper->getRepositoryFullFilename()) || $forceOverwrite; |
@@ -73,11 +73,18 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | + /** |
|
| 77 | + * @param string $file |
|
| 78 | + * @param boolean $forceOverwrite |
|
| 79 | + */ |
|
| 76 | 80 | protected function canWriteToFile($file, $forceOverwrite) |
| 77 | 81 | { |
| 78 | 82 | return !file_exists($file) || $forceOverwrite; |
| 79 | 83 | } |
| 80 | 84 | |
| 85 | + /** |
|
| 86 | + * @param string $filePath |
|
| 87 | + */ |
|
| 81 | 88 | protected function writeYamlToFile($filePath, array $data) |
| 82 | 89 | { |
| 83 | 90 | $yaml = Yaml::dump($data, 4); |
@@ -110,6 +117,9 @@ discard block |
||
| 110 | 117 | } |
| 111 | 118 | } |
| 112 | 119 | |
| 120 | + /** |
|
| 121 | + * @param string $filePath |
|
| 122 | + */ |
|
| 113 | 123 | protected function getYamlFileContent($filePath) |
| 114 | 124 | { |
| 115 | 125 | return file_exists($filePath) ? Yaml::parse($filePath) : []; |
@@ -119,7 +129,7 @@ discard block |
||
| 119 | 129 | * Returns an array of fields. Fields can be both column fields and |
| 120 | 130 | * association fields. |
| 121 | 131 | * |
| 122 | - * @param $entityName |
|
| 132 | + * @param string $entityName |
|
| 123 | 133 | * @param ClassMetadataInfo $metadata |
| 124 | 134 | * |
| 125 | 135 | * @return array $fields |
@@ -172,6 +182,9 @@ discard block |
||
| 172 | 182 | return $result; |
| 173 | 183 | } |
| 174 | 184 | |
| 185 | + /** |
|
| 186 | + * @param string $entityName |
|
| 187 | + */ |
|
| 175 | 188 | private function getRelationsFromMetadata($entityName) |
| 176 | 189 | { |
| 177 | 190 | $result = []; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function generate(ClassMetadataInfo $metadata, $forceOverwrite = false) |
| 43 | 43 | { |
| 44 | - $file = $this->helper->getResourcesDirname() . '/config/serializer/Entity.' . $this->helper->getEntityClass() . '.yml'; |
|
| 44 | + $file = $this->helper->getResourcesDirname().'/config/serializer/Entity.'.$this->helper->getEntityClass().'.yml'; |
|
| 45 | 45 | |
| 46 | 46 | if (!file_exists(dirname($file)) && !@mkdir(dirname($file), 0777, true)) { |
| 47 | 47 | throw new IOException('Unable to create config/serializer directory'); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | $targetClassName = basename($targetClass); |
| 95 | 95 | |
| 96 | - $targetPath = $dirPath . '/Entity.' . $targetClassName . '.yml'; |
|
| 96 | + $targetPath = $dirPath.'/Entity.'.$targetClassName.'.yml'; |
|
| 97 | 97 | $targetData = $this->getYamlFileContent($targetPath); |
| 98 | 98 | |
| 99 | 99 | if (isset($targetData[$targetClass])) { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | $groups = []; |
| 180 | 180 | foreach ($this->excludedRelationPrefixSuffixPairs as $pair) { |
| 181 | - $groups[] = $pair[0] . $entityName . $pair[1]; |
|
| 181 | + $groups[] = $pair[0].$entityName.$pair[1]; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | $result[] = [ |
@@ -144,6 +144,9 @@ |
||
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | + /** |
|
| 148 | + * @param string $dataclass |
|
| 149 | + */ |
|
| 147 | 150 | protected function getAutocompleteUrl($dataclass) |
| 148 | 151 | { |
| 149 | 152 | $entityName = $dataclass; |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | { |
| 149 | 149 | $entityName = $dataclass; |
| 150 | 150 | |
| 151 | - $routeName = 'autocomplete_' . strtolower($entityName); |
|
| 151 | + $routeName = 'autocomplete_'.strtolower($entityName); |
|
| 152 | 152 | |
| 153 | 153 | return $this->router->getRouteCollection()->get($routeName) ? $this->router->generate($routeName) : null; |
| 154 | 154 | } |