@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $forceOverwrite = $input->getOption('overwrite'); |
| 63 | 63 | |
| 64 | - $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($bundle).'\\'.$entity; |
|
| 64 | + $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($bundle) . '\\' . $entity; |
|
| 65 | 65 | $metadata = $this->getEntityMetadata($entityClass); |
| 66 | 66 | $bundle = $this->getApplication()->getKernel()->getBundle($bundle); |
| 67 | 67 | $generator = $this->getGenerator($bundle); |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | $skeletonDirs = parent::getSkeletonDirs($bundle); |
| 95 | 95 | |
| 96 | - if (isset($bundle) && is_dir($dir = $bundle->getPath().'/Resources/skeleton')) { |
|
| 96 | + if (isset($bundle) && is_dir($dir = $bundle->getPath() . '/Resources/skeleton')) { |
|
| 97 | 97 | $skeletonDirs[] = $dir; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if (is_dir($dir = $this->getContainer()->get('kernel')->getRootdir().'/Resources/skeleton')) { |
|
| 100 | + if (is_dir($dir = $this->getContainer()->get('kernel')->getRootdir() . '/Resources/skeleton')) { |
|
| 101 | 101 | $skeletonDirs[] = $dir; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $entity = Validators::validateEntityName($input->getArgument('entity')); |
| 51 | 51 | list($bundle, $entity) = $this->parseShortcutNotation($entity); |
| 52 | 52 | |
| 53 | - $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($bundle).'\\'.$entity; |
|
| 53 | + $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($bundle) . '\\' . $entity; |
|
| 54 | 54 | $metadata = $this->getEntityMetadata($entityClass); |
| 55 | 55 | $bundle = $this->getApplication()->getKernel()->getBundle($bundle); |
| 56 | 56 | $generator = $this->getGenerator($bundle); |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | $skeletonDirs = parent::getSkeletonDirs($bundle); |
| 83 | 83 | |
| 84 | - if (isset($bundle) && is_dir($dir = $bundle->getPath().'/Resources/skeleton')) { |
|
| 84 | + if (isset($bundle) && is_dir($dir = $bundle->getPath() . '/Resources/skeleton')) { |
|
| 85 | 85 | $skeletonDirs[] = $dir; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if (is_dir($dir = $this->getContainer()->get('kernel')->getRootdir().'/Resources/skeleton')) { |
|
| 88 | + if (is_dir($dir = $this->getContainer()->get('kernel')->getRootdir() . '/Resources/skeleton')) { |
|
| 89 | 89 | $skeletonDirs[] = $dir; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $questionHelper->writeSection($output, 'REST generation'); |
| 93 | 93 | |
| 94 | 94 | try { |
| 95 | - $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($bundle).'\\'.$entity; |
|
| 95 | + $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($bundle) . '\\' . $entity; |
|
| 96 | 96 | $metadata = $this->getEntityMetadata($entityClass); |
| 97 | 97 | } catch (\Exception $e) { |
| 98 | 98 | throw new \RuntimeException(sprintf('Entity "%s" does not exist in the "%s" bundle. Create it with the "doctrine:generate:entity" command and then execute this command again.', $entity, $bundle)); |
@@ -167,11 +167,11 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | $skeletonDirs = parent::getSkeletonDirs($bundle); |
| 169 | 169 | |
| 170 | - if (isset($bundle) && is_dir($dir = $bundle->getPath().'/Resources/skeleton')) { |
|
| 170 | + if (isset($bundle) && is_dir($dir = $bundle->getPath() . '/Resources/skeleton')) { |
|
| 171 | 171 | $skeletonDirs[] = $dir; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - if (is_dir($dir = $this->getContainer()->get('kernel')->getRootdir().'/Resources/skeleton')) { |
|
| 174 | + if (is_dir($dir = $this->getContainer()->get('kernel')->getRootdir() . '/Resources/skeleton')) { |
|
| 175 | 175 | $skeletonDirs[] = $dir; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | $parts = explode('\\', $entity); |
| 47 | 47 | $entityClass = array_pop($parts); |
| 48 | 48 | |
| 49 | - $this->className = $entityClass.'Type'; |
|
| 50 | - $dirPath = $bundle->getPath().'/Form'; |
|
| 51 | - $this->classPath = $dirPath.'/'.str_replace('\\', '/', $entity).'Type.php'; |
|
| 49 | + $this->className = $entityClass . 'Type'; |
|
| 50 | + $dirPath = $bundle->getPath() . '/Form'; |
|
| 51 | + $this->classPath = $dirPath . '/' . str_replace('\\', '/', $entity) . 'Type.php'; |
|
| 52 | 52 | |
| 53 | 53 | if (!$forceOverwrite && file_exists($this->classPath)) { |
| 54 | 54 | throw new \RuntimeException(sprintf('Unable to generate the %s form class as it already exists under the %s file', $this->className, $this->classPath)); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | 'entity_class' => $entityClass, |
| 74 | 74 | 'bundle' => $bundle->getName(), |
| 75 | 75 | 'form_class' => $this->className, |
| 76 | - 'form_type_name' => strtolower(str_replace('\\', '_', $bundle->getNamespace()).($parts ? '_' : '').implode('_', $parts).'_'.substr($this->className, 0, -4)), |
|
| 76 | + 'form_type_name' => strtolower(str_replace('\\', '_', $bundle->getNamespace()) . ($parts ? '_' : '') . implode('_', $parts) . '_' . substr($this->className, 0, -4)), |
|
| 77 | 77 | |
| 78 | 78 | // Add 'setDefaultOptions' method with deprecated type hint, if the new 'configureOptions' isn't available. |
| 79 | 79 | // Required as long as Symfony 2.6 is supported. |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | private function getFieldsFromMetadata(ClassMetadataInfo $metadata) |
| 89 | 89 | { |
| 90 | - $fields = (array) $metadata->fieldNames; |
|
| 90 | + $fields = (array)$metadata->fieldNames; |
|
| 91 | 91 | |
| 92 | 92 | // Remove the primary key field if it's not managed manually |
| 93 | 93 | if (!$metadata->isIdentifierNatural()) { |
@@ -69,15 +69,15 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | foreach ($items as $item) { |
| 71 | 71 | if ('Gateway' == $arguments['type'] && '' == $item) { |
| 72 | - $arguments['dir'] = str_replace('Model/'.$this->entity, 'Repository', $arguments['dir']); |
|
| 72 | + $arguments['dir'] = str_replace('Model/' . $this->entity, 'Repository', $arguments['dir']); |
|
| 73 | 73 | $serviceNamespace = $arguments['dir']; |
| 74 | 74 | } |
| 75 | - $dir = $this->bundle->getPath().'/'.$arguments['dir']; |
|
| 75 | + $dir = $this->bundle->getPath() . '/' . $arguments['dir']; |
|
| 76 | 76 | |
| 77 | 77 | $target = sprintf( |
| 78 | 78 | '%s/%s.php', |
| 79 | 79 | $dir, |
| 80 | - $arguments['classname'].$item |
|
| 80 | + $arguments['classname'] . $item |
|
| 81 | 81 | ); |
| 82 | 82 | |
| 83 | 83 | if (!$forceOverwrite && file_exists($target)) { |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $this->processRenderFile( |
| 93 | - sprintf('repository/%s.php.twig', strtolower($arguments['type']).$item), |
|
| 93 | + sprintf('repository/%s.php.twig', strtolower($arguments['type']) . $item), |
|
| 94 | 94 | $target, |
| 95 | 95 | $arguments['classname'], |
| 96 | 96 | $entityClass, |
@@ -108,12 +108,12 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function generateEntityInterface($arguments, $forceOverwrite) |
| 110 | 110 | { |
| 111 | - $dir = $this->bundle->getPath().'/'.$arguments['dir']; |
|
| 111 | + $dir = $this->bundle->getPath() . '/' . $arguments['dir']; |
|
| 112 | 112 | |
| 113 | 113 | $parts = explode('\\', $this->entity); |
| 114 | 114 | $entityClass = array_pop($parts); |
| 115 | 115 | $serviceNamespace = $arguments['dir']; |
| 116 | - $arguments['classname'] = $entityClass.'Interface'; |
|
| 116 | + $arguments['classname'] = $entityClass . 'Interface'; |
|
| 117 | 117 | $target = sprintf( |
| 118 | 118 | '%s/%s.php', |
| 119 | 119 | $dir, |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | $dir = sprintf('%s/../tests/%s/Model/', $this->rootDir, $this->bundle->getName()); |
| 143 | 143 | |
| 144 | - $target = $dir.$entityClass.'RepositoryTest.php'; |
|
| 144 | + $target = $dir . $entityClass . 'RepositoryTest.php'; |
|
| 145 | 145 | |
| 146 | 146 | $this->processRenderFile( |
| 147 | 147 | 'crud/tests/repositoryTest.php.twig', |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | continue; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - $data[] = $yaml->parse(file_get_contents($dir.'/'.$file)); |
|
| 218 | + $data[] = $yaml->parse(file_get_contents($dir . '/' . $file)); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | return $data; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | protected function generateHandlers($arguments, $forceOverwrite) |
| 99 | 99 | { |
| 100 | - $dir = $this->bundle->getPath().'/'.$arguments['dir']; |
|
| 100 | + $dir = $this->bundle->getPath() . '/' . $arguments['dir']; |
|
| 101 | 101 | |
| 102 | 102 | $parts = explode('\\', $this->entity); |
| 103 | 103 | $entityClass = array_pop($parts); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | $dir = sprintf('%s/../tests/%s/Controller/', $this->rootDir, $this->bundle->getName()); |
| 141 | 141 | |
| 142 | - $target = $dir.$entityClass.'ControllerTest.php'; |
|
| 142 | + $target = $dir . $entityClass . 'ControllerTest.php'; |
|
| 143 | 143 | |
| 144 | 144 | $this->processRenderFile( |
| 145 | 145 | 'crud/tests/controllerTest.php.twig', |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | continue; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - $data[] = $yaml->parse(file_get_contents($dir.'/'.$file)); |
|
| 236 | + $data[] = $yaml->parse(file_get_contents($dir . '/' . $file)); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | return $data; |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $this->format |
| 256 | 256 | ); |
| 257 | 257 | |
| 258 | - $this->renderFile('crud/config/routing.'.$this->format.'.twig', $target, array( |
|
| 258 | + $this->renderFile('crud/config/routing.' . $this->format . '.twig', $target, array( |
|
| 259 | 259 | 'actions' => $this->actions, |
| 260 | 260 | 'route_prefix' => $this->routePrefix, |
| 261 | 261 | 'route_name_prefix' => $this->routeNamePrefix, |