@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | )); |
58 | 58 | } |
59 | 59 | |
60 | - return $collection->map(function ($entity) { |
|
60 | + return $collection->map(function($entity) { |
|
61 | 61 | try { |
62 | 62 | $entityString = (string) $entity; |
63 | 63 | } catch (\Exception $e) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | return $collection; |
98 | 98 | } |
99 | 99 | |
100 | - return $collection->map(function ($id) { |
|
100 | + return $collection->map(function($id) { |
|
101 | 101 | $entity = $this->entityManager |
102 | 102 | ->getRepository($this->entityName) |
103 | 103 | ->find($id) |
@@ -38,8 +38,8 @@ |
||
38 | 38 | if ($resolver instanceof OptionsResolver) { |
39 | 39 | $resolver->setAllowedTypes('entityName', ['string']); |
40 | 40 | $resolver->setDefined(['entityName']); |
41 | - $resolver->setDefault('invalid_message', function (Options $options) { |
|
42 | - return 'This value is not valid. Unable to find ' . $options['entityName'] . ' in the database.'; |
|
41 | + $resolver->setDefault('invalid_message', function(Options $options) { |
|
42 | + return 'This value is not valid. Unable to find '.$options['entityName'].' in the database.'; |
|
43 | 43 | }); |
44 | 44 | } |
45 | 45 | } |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | $this->objectManager = $objectManager; |
24 | 24 | } |
25 | 25 | |
26 | - /** |
|
27 | - * @inheritdoc |
|
28 | - */ |
|
29 | - public function buildForm(FormBuilderInterface $builder, array $options) |
|
26 | + /** |
|
27 | + * @inheritdoc |
|
28 | + */ |
|
29 | + public function buildForm(FormBuilderInterface $builder, array $options) |
|
30 | 30 | { |
31 | 31 | $transformer = new RestCollectionTransformer($this->objectManager, $options['entityName']); |
32 | 32 | $viewTransformer = new ArrayToStringTransformer(); |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | $builder->addViewTransformer($viewTransformer); |
35 | 35 | } |
36 | 36 | |
37 | - /** |
|
38 | - * @inheritdoc |
|
39 | - */ |
|
37 | + /** |
|
38 | + * @inheritdoc |
|
39 | + */ |
|
40 | 40 | public function configureOptions(OptionsResolver $resolver) |
41 | 41 | { |
42 | 42 | $resolver->setRequired(['entityName']); |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | - /** |
|
54 | - * @inheritdoc |
|
55 | - */ |
|
56 | - public function getName() |
|
57 | - { |
|
58 | - return 'collection'; |
|
59 | - } |
|
53 | + /** |
|
54 | + * @inheritdoc |
|
55 | + */ |
|
56 | + public function getName() |
|
57 | + { |
|
58 | + return 'collection'; |
|
59 | + } |
|
60 | 60 | } |
@@ -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; |
@@ -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->getRepositoryFullFilename()) || $forceOverwrite; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function __construct(BundleInterface $bundle, $entity, ClassMetadataInfo $metadata) |
24 | 24 | { |
25 | 25 | if (count($metadata->getIdentifier()) > 1) { |
26 | - throw new \RuntimeException(__CLASS__ . ' does not support entity classes with multiple primary keys.'); |
|
26 | + throw new \RuntimeException(__CLASS__.' does not support entity classes with multiple primary keys.'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | $this->entityClass = $this->prepareEntityClass($entity); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | if (!$this->canWriteToFile($formPath, $forceOverwrite)) { |
51 | 51 | throw new \RuntimeException(sprintf( |
52 | 52 | 'Unable to generate the %s form class as it already exists under the file: %s', |
53 | - $this->entityClass . 'Type', |
|
53 | + $this->entityClass.'Type', |
|
54 | 54 | $formPath |
55 | 55 | )); |
56 | 56 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'entity_class' => $this->entityClass, |
80 | 80 | 'rest_support' => true, |
81 | 81 | 'rest_form_type_name' => $this->prepareFormAlias($this->entityClass), |
82 | - 'form_type_name' => $this->prepareFormTypeName($this->entity, $this->namespace, $this->entityClass) . 'filter' |
|
82 | + 'form_type_name' => $this->prepareFormTypeName($this->entity, $this->namespace, $this->entityClass).'filter' |
|
83 | 83 | ] |
84 | 84 | ); |
85 | 85 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | protected function prepareFormAlias($entityClass) |
100 | 100 | { |
101 | - return ltrim(preg_replace_callback('|[A-Z]+|', function ($data) { |
|
101 | + return ltrim(preg_replace_callback('|[A-Z]+|', function($data) { |
|
102 | 102 | return '_'.strtolower($data[0]); |
103 | 103 | }, $entityClass), '_'); |
104 | 104 | } |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | str_replace('\\', '_', $namespace) |
111 | 111 | . ($parts ? '_' : '') |
112 | 112 | . implode('_', $parts) |
113 | - . '_' . $entityClass |
|
113 | + . '_'.$entityClass |
|
114 | 114 | ); |
115 | 115 | } |
116 | 116 | |
117 | 117 | protected function prepareFilePath($path, $postfix) |
118 | 118 | { |
119 | - return $this->bundlePath . $path . str_replace('\\', '/', $this->entity) . $postfix . '.php'; |
|
119 | + return $this->bundlePath.$path.str_replace('\\', '/', $this->entity).$postfix.'.php'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | $matches = []; |
24 | 24 | preg_match('/^get([A-Z][a-z]+)((Full)?[A-Z][a-z]+)$/', $name, $matches); |
25 | 25 | if (empty($matches)) { |
26 | - throw new \Exception('Unsupported method: ' . $name); |
|
26 | + throw new \Exception('Unsupported method: '.$name); |
|
27 | 27 | } |
28 | 28 | $category = $matches[1]; |
29 | 29 | $type = $matches[2]; |
30 | 30 | |
31 | - $method = 'get' . $type; |
|
31 | + $method = 'get'.$type; |
|
32 | 32 | if (!method_exists($this, $method)) { |
33 | - throw new \Exception('Unsupported method: ' . $name); |
|
33 | + throw new \Exception('Unsupported method: '.$name); |
|
34 | 34 | } |
35 | 35 | return $this->$method($category, $args); |
36 | 36 | } |
@@ -42,33 +42,33 @@ discard block |
||
42 | 42 | |
43 | 43 | protected function getFullClass($category, $args) |
44 | 44 | { |
45 | - return $this->getNamespace($category, $args) . '\\' . $this->entityClass . $this->getClassSuffix($category); |
|
45 | + return $this->getNamespace($category, $args).'\\'.$this->entityClass.$this->getClassSuffix($category); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | protected function getClass($category) |
49 | 49 | { |
50 | - return basename($this->entityClass . $this->getClassSuffix($category)); |
|
50 | + return basename($this->entityClass.$this->getClassSuffix($category)); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | protected function getNamespace($category) |
54 | 54 | { |
55 | - return $this->bundleNamespace . '\\' . $category; |
|
55 | + return $this->bundleNamespace.'\\'.$category; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | protected function getFullFilename($category, $args) |
59 | 59 | { |
60 | - $filename = isset($args[0]) ? $args[0] : (str_replace('\\', '/', $this->entityClass) . $this->getClassSuffix($category) . '.php'); |
|
61 | - return $this->getDirname($category, $args) . '/' . $filename; |
|
60 | + $filename = isset($args[0]) ? $args[0] : (str_replace('\\', '/', $this->entityClass).$this->getClassSuffix($category).'.php'); |
|
61 | + return $this->getDirname($category, $args).'/'.$filename; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | protected function getFilename($category, $args) |
65 | 65 | { |
66 | - return basename(isset($args[0]) ? $args[0] : (str_replace('\\', '/', $this->entityClass) . $this->getClassSuffix($category) . '.php')); |
|
66 | + return basename(isset($args[0]) ? $args[0] : (str_replace('\\', '/', $this->entityClass).$this->getClassSuffix($category).'.php')); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | protected function getDirname($category) |
70 | 70 | { |
71 | - return $this->bundleRoot . '/' . $category; |
|
71 | + return $this->bundleRoot.'/'.$category; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function camelToUnderscore($string) |
@@ -38,8 +38,8 @@ |
||
38 | 38 | if ($resolver instanceof OptionsResolver) { |
39 | 39 | $resolver->setAllowedTypes('entityName', ['string']); |
40 | 40 | $resolver->setDefined(['entityName']); |
41 | - $resolver->setDefault('invalid_message', function (Options $options) { |
|
42 | - return 'This value is not valid. Unable to find ' . $options['entityName'] . ' in the database.'; |
|
41 | + $resolver->setDefault('invalid_message', function(Options $options) { |
|
42 | + return 'This value is not valid. Unable to find '.$options['entityName'].' in the database.'; |
|
43 | 43 | }); |
44 | 44 | } |
45 | 45 | } |
@@ -22,19 +22,19 @@ discard block |
||
22 | 22 | $this->objectManager = $objectManager; |
23 | 23 | } |
24 | 24 | |
25 | - /** |
|
26 | - * @inheritdoc |
|
27 | - */ |
|
28 | - public function buildForm(FormBuilderInterface $builder, array $options) |
|
25 | + /** |
|
26 | + * @inheritdoc |
|
27 | + */ |
|
28 | + public function buildForm(FormBuilderInterface $builder, array $options) |
|
29 | 29 | { |
30 | 30 | $transformer = new RestEntityTransformer($this->objectManager, $options['entityName']); |
31 | 31 | $builder->addModelTransformer($transformer); |
32 | 32 | } |
33 | 33 | |
34 | - /** |
|
35 | - * @inheritdoc |
|
36 | - */ |
|
37 | - public function configureOptions(OptionsResolver $resolver) |
|
34 | + /** |
|
35 | + * @inheritdoc |
|
36 | + */ |
|
37 | + public function configureOptions(OptionsResolver $resolver) |
|
38 | 38 | { |
39 | 39 | $resolver->setRequired(['entityName']); |
40 | 40 | |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | - /** |
|
51 | - * @inheritdoc |
|
52 | - */ |
|
53 | - public function getName() |
|
54 | - { |
|
55 | - return 'entity'; |
|
56 | - } |
|
50 | + /** |
|
51 | + * @inheritdoc |
|
52 | + */ |
|
53 | + public function getName() |
|
54 | + { |
|
55 | + return 'entity'; |
|
56 | + } |
|
57 | 57 | } |