@@ -13,8 +13,6 @@ |
||
13 | 13 | use APY\DataGridBundle\Grid\Export\ExcelExport; |
14 | 14 | use APY\DataGridBundle\Grid\Export\CSVExport; |
15 | 15 | use APY\DataGridBundle\Grid\Export\XMLExport; |
16 | -use TMSolution\DataGridBundle\Grid\Column\NumberColumn; |
|
17 | -use TMSolution\DataGridBundle\Grid\Column\TextColumn; |
|
18 | 16 | use TMSolution\DataGridBundle\Grid\Action\RowAction; |
19 | 17 | use TMSolution\DataGridBundle\GridConfig\GridConfig; |
20 | 18 |
@@ -92,7 +92,7 @@ |
||
92 | 92 | $parentFieldName = $this->getParentFieldNameFromRequest(); |
93 | 93 | |
94 | 94 | |
95 | - $queryBuilderFn = function ($queryBuilder) use($tableAlias, $parentFieldName, $parentId) { |
|
95 | + $queryBuilderFn = function($queryBuilder) use($tableAlias, $parentFieldName, $parentId) { |
|
96 | 96 | |
97 | 97 | $queryBuilder->leftJoin("$tableAlias.$parentFieldName", "_$parentFieldName"); |
98 | 98 | $queryBuilder->Where("_$parentFieldName.id=:$parentFieldName"); |
@@ -64,6 +64,9 @@ |
||
64 | 64 | |
65 | 65 | } |
66 | 66 | |
67 | + /** |
|
68 | + * @param InputInterface $input |
|
69 | + */ |
|
67 | 70 | protected function getConfigFilePath($manager, $input) |
68 | 71 | { |
69 | 72 | $bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('configBundle')); |
@@ -18,9 +18,6 @@ |
||
18 | 18 | use Symfony\Component\Console\Input\InputOption; |
19 | 19 | use Symfony\Component\Console\Input\ArrayInput; |
20 | 20 | use Symfony\Component\Console\Output\NullOutput; |
21 | -use ReflectionClass; |
|
22 | -use LogicException; |
|
23 | -use UnexpectedValueException; |
|
24 | 21 | |
25 | 22 | /** |
26 | 23 | * GenerateFilesCommand generates all configuration. |
@@ -78,6 +78,10 @@ discard block |
||
78 | 78 | return $classPath; |
79 | 79 | } |
80 | 80 | |
81 | + /** |
|
82 | + * @param string $entityNamespace |
|
83 | + * @param string $objectName |
|
84 | + */ |
|
81 | 85 | protected function createDirectory($path, $classPath, $entityNamespace, $objectName, $rootFolder) |
82 | 86 | { |
83 | 87 | |
@@ -104,6 +108,9 @@ discard block |
||
104 | 108 | return $fileName; |
105 | 109 | } |
106 | 110 | |
111 | + /** |
|
112 | + * @param string $fileName |
|
113 | + */ |
|
107 | 114 | protected function isFileNameBusy($fileName) |
108 | 115 | { |
109 | 116 | if (file_exists($fileName) == true) { |
@@ -112,6 +119,10 @@ discard block |
||
112 | 119 | return false; |
113 | 120 | } |
114 | 121 | |
122 | + /** |
|
123 | + * @param string $search |
|
124 | + * @param string $replace |
|
125 | + */ |
|
115 | 126 | protected function replaceLast($search, $replace, $subject) |
116 | 127 | { |
117 | 128 | $position = strrpos($subject, $search); |
@@ -182,6 +193,9 @@ discard block |
||
182 | 193 | $output->writeln("Form type " . $entityName . " generated"); |
183 | 194 | } |
184 | 195 | |
196 | + /** |
|
197 | + * @param OutputInterface $output |
|
198 | + */ |
|
185 | 199 | protected function runAssociatedObjectsRecursively($fieldsInfo, $rootPath, $rootFolder, $output,$configEntityName) |
186 | 200 | { |
187 | 201 | $associations = []; |
@@ -204,6 +218,10 @@ discard block |
||
204 | 218 | } |
205 | 219 | } |
206 | 220 | |
221 | + /** |
|
222 | + * @param InputInterface $input |
|
223 | + * @param OutputInterface $output |
|
224 | + */ |
|
207 | 225 | protected function getConfigEntityName($input,$output) |
208 | 226 | { |
209 | 227 | $manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine')); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $entityNamespace = $entityNamespace . DIRECTORY_SEPARATOR . $path; |
86 | 86 | } |
87 | 87 | |
88 | - $directory = $this->replaceLast("Entity", "Config\\".$rootFolder, str_replace("\\", DIRECTORY_SEPARATOR, ($classPath . "\\" . $entityNamespace))); |
|
88 | + $directory = $this->replaceLast("Entity", "Config\\" . $rootFolder, str_replace("\\", DIRECTORY_SEPARATOR, ($classPath . "\\" . $entityNamespace))); |
|
89 | 89 | |
90 | 90 | if (is_dir($directory) == false) { |
91 | 91 | if (mkdir($directory, 0777, true) == false) { |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | return $subject; |
122 | 122 | } |
123 | 123 | |
124 | - protected function getFormTypeNamespaceName($entityName,$configEntityName, $path,$rootFolder) |
|
124 | + protected function getFormTypeNamespaceName($entityName, $configEntityName, $path, $rootFolder) |
|
125 | 125 | { |
126 | - $directory = "Config\\".$rootFolder; |
|
126 | + $directory = "Config\\" . $rootFolder; |
|
127 | 127 | if ($path) { |
128 | - $directory = str_replace(DIRECTORY_SEPARATOR, "\\", "Config\\".$rootFolder."\\" . $path); |
|
128 | + $directory = str_replace(DIRECTORY_SEPARATOR, "\\", "Config\\" . $rootFolder . "\\" . $path); |
|
129 | 129 | } |
130 | 130 | $entityNameArr = explode("\\", str_replace("Entity", $directory, $configEntityName/*$entityName*/)); |
131 | 131 | unset($entityNameArr[count($entityNameArr) - 1]); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | - protected function addFile($entityName, $path, $fieldsInfo, $rootFolder, $output,$configEntityName) |
|
145 | + protected function addFile($entityName, $path, $fieldsInfo, $rootFolder, $output, $configEntityName) |
|
146 | 146 | { |
147 | 147 | $confgEntityReflection = new ReflectionClass($configEntityName); |
148 | 148 | $configEntityNamespace = $confgEntityReflection->getNamespaceName(); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $this->isFileNameBusy($fileName); |
162 | 162 | $templating = $this->getContainer()->get('templating'); |
163 | 163 | $formTypeNamespaceName = $this->getFormTypeNamespaceName($entityName, $configEntityName, $path, $rootFolder); |
164 | - $formTypeName = strtolower(str_replace('\\', '_', $entityNamespace).'_'.$objectName); |
|
164 | + $formTypeName = strtolower(str_replace('\\', '_', $entityNamespace) . '_' . $objectName); |
|
165 | 165 | |
166 | 166 | foreach ($fieldsInfo as $key => $field) { |
167 | 167 | $fieldsInfo[$key]['formType'] = $this->types[$field['type']]; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $output->writeln("Form type " . $entityName . " generated"); |
183 | 183 | } |
184 | 184 | |
185 | - protected function runAssociatedObjectsRecursively($fieldsInfo, $rootPath, $rootFolder, $output,$configEntityName) |
|
185 | + protected function runAssociatedObjectsRecursively($fieldsInfo, $rootPath, $rootFolder, $output, $configEntityName) |
|
186 | 186 | { |
187 | 187 | $associations = []; |
188 | 188 | foreach ($fieldsInfo as $key => $value) { |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | |
200 | 200 | |
201 | 201 | |
202 | - $this->addFile($value['object_name'], $rootPath.DIRECTORY_SEPARATOR.$path, $assocObjectFieldsInfo, $rootFolder, $output,$configEntityName); |
|
202 | + $this->addFile($value['object_name'], $rootPath . DIRECTORY_SEPARATOR . $path, $assocObjectFieldsInfo, $rootFolder, $output, $configEntityName); |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | - protected function getConfigEntityName($input,$output) |
|
207 | + protected function getConfigEntityName($input, $output) |
|
208 | 208 | { |
209 | 209 | $manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine')); |
210 | 210 | |
@@ -255,15 +255,15 @@ discard block |
||
255 | 255 | |
256 | 256 | |
257 | 257 | //configNameSpace |
258 | - $configEntityName=$this->getConfigEntityName($input,$output); |
|
258 | + $configEntityName = $this->getConfigEntityName($input, $output); |
|
259 | 259 | |
260 | - $this->addFile($entityName, $path, $fieldsInfo, $rootFolder, $output,$configEntityName); |
|
260 | + $this->addFile($entityName, $path, $fieldsInfo, $rootFolder, $output, $configEntityName); |
|
261 | 261 | |
262 | 262 | |
263 | 263 | //generate assoc form types |
264 | 264 | if (true === $input->getOption('withAssociated')) { |
265 | 265 | |
266 | - $this->runAssociatedObjectsRecursively($fieldsInfo,$path, $rootFolder,$output,$configEntityName); |
|
266 | + $this->runAssociatedObjectsRecursively($fieldsInfo, $path, $rootFolder, $output, $configEntityName); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 |
@@ -59,6 +59,9 @@ discard block |
||
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
62 | + /** |
|
63 | + * @param InputInterface $input |
|
64 | + */ |
|
62 | 65 | protected function getEntityName($input) |
63 | 66 | { |
64 | 67 | $doctrine = $this->getContainer()->get('doctrine'); |
@@ -78,6 +81,10 @@ discard block |
||
78 | 81 | } |
79 | 82 | |
80 | 83 | |
84 | + /** |
|
85 | + * @param string $entityNamespace |
|
86 | + * @param string $objectName |
|
87 | + */ |
|
81 | 88 | protected function createDirectory($classPath, $entityNamespace,$configEntityName, $objectName, $path, $rootFolder) |
82 | 89 | { |
83 | 90 | |
@@ -97,6 +104,10 @@ discard block |
||
97 | 104 | return $directory; |
98 | 105 | } |
99 | 106 | |
107 | + /** |
|
108 | + * @param string $entityNamespace |
|
109 | + * @param string $objectName |
|
110 | + */ |
|
100 | 111 | protected function createNameSpace($entityNamespace, $objectName, $path, $rootFolder,$configEntityName) |
101 | 112 | { |
102 | 113 | |
@@ -123,6 +134,9 @@ discard block |
||
123 | 134 | return $fileName; |
124 | 135 | } |
125 | 136 | |
137 | + /** |
|
138 | + * @param string $fileName |
|
139 | + */ |
|
126 | 140 | protected function isFileNameBusy($fileName) |
127 | 141 | { |
128 | 142 | if (file_exists($fileName) == true) { |
@@ -131,6 +145,10 @@ discard block |
||
131 | 145 | return false; |
132 | 146 | } |
133 | 147 | |
148 | + /** |
|
149 | + * @param string $search |
|
150 | + * @param string $replace |
|
151 | + */ |
|
134 | 152 | protected function replaceLast($search, $replace, $subject) |
135 | 153 | { |
136 | 154 | $position = strrpos($subject, $search); |
@@ -205,6 +223,9 @@ discard block |
||
205 | 223 | $output->writeln(sprintf("List config generated for <info>%s</info>", $entityName)); |
206 | 224 | } |
207 | 225 | |
226 | + /** |
|
227 | + * @param OutputInterface $output |
|
228 | + */ |
|
208 | 229 | protected function runAssociatedObjects($fieldsInfo, $analyzeFieldsInfo, $entityName, $rootPath, $rootFolder, $output,$configEntityName) |
209 | 230 | { |
210 | 231 | $associations = []; |
@@ -229,6 +250,10 @@ discard block |
||
229 | 250 | } |
230 | 251 | } |
231 | 252 | |
253 | + /** |
|
254 | + * @param InputInterface $input |
|
255 | + * @param OutputInterface $output |
|
256 | + */ |
|
232 | 257 | protected function getConfigEntityName($input,$output) |
233 | 258 | { |
234 | 259 | $manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine')); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | |
81 | - protected function createDirectory($classPath, $entityNamespace,$configEntityName, $objectName, $path, $rootFolder) |
|
81 | + protected function createDirectory($classPath, $entityNamespace, $configEntityName, $objectName, $path, $rootFolder) |
|
82 | 82 | { |
83 | 83 | |
84 | 84 | if ($path) { |
@@ -97,18 +97,18 @@ discard block |
||
97 | 97 | return $directory; |
98 | 98 | } |
99 | 99 | |
100 | - protected function createNameSpace($entityNamespace, $objectName, $path, $rootFolder,$configEntityName) |
|
100 | + protected function createNameSpace($entityNamespace, $objectName, $path, $rootFolder, $configEntityName) |
|
101 | 101 | { |
102 | 102 | |
103 | 103 | |
104 | - $directory = "Config\\".$rootFolder; |
|
104 | + $directory = "Config\\" . $rootFolder; |
|
105 | 105 | if ($path) { |
106 | - $directory = str_replace(DIRECTORY_SEPARATOR, "\\", "Config\\".$rootFolder."\\" . $path); |
|
106 | + $directory = str_replace(DIRECTORY_SEPARATOR, "\\", "Config\\" . $rootFolder . "\\" . $path); |
|
107 | 107 | } |
108 | 108 | $entityNameArr = explode("\\", str_replace("Entity", $directory, $configEntityName/*$entityName*/)); |
109 | 109 | unset($entityNameArr[count($entityNameArr) - 1]); |
110 | 110 | |
111 | - $this->namespace=implode("\\", $entityNameArr); |
|
111 | + $this->namespace = implode("\\", $entityNameArr); |
|
112 | 112 | return $this->namespace; |
113 | 113 | |
114 | 114 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | foreach ($fieldsInfo as $key => $value) { |
148 | 148 | |
149 | 149 | |
150 | - if (array_key_exists("association", $fieldsInfo[$key]) && ( $fieldsInfo[$key]["association"] == "ManyToOne" || $fieldsInfo[$key]["association"] == "OneToOne" )) { |
|
150 | + if (array_key_exists("association", $fieldsInfo[$key]) && ($fieldsInfo[$key]["association"] == "ManyToOne" || $fieldsInfo[$key]["association"] == "OneToOne")) { |
|
151 | 151 | |
152 | 152 | if ($fieldsInfo[$key]["association"] == "ManyToMany") { |
153 | 153 | $this->manyToManyRelationExists = true; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $fieldsInfo[$key]["default_field"] = "id"; |
163 | 163 | $fieldsInfo[$key]["default_field_type"] = "Number"; |
164 | 164 | } |
165 | - } elseif (array_key_exists("association", $fieldsInfo[$key]) && ( $fieldsInfo[$key]["association"] == "ManyToMany" || $fieldsInfo[$key]["association"] == "OneToMany" )) { |
|
165 | + } elseif (array_key_exists("association", $fieldsInfo[$key]) && ($fieldsInfo[$key]["association"] == "ManyToMany" || $fieldsInfo[$key]["association"] == "OneToMany")) { |
|
166 | 166 | unset($fieldsInfo[$key]); |
167 | 167 | } |
168 | 168 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | return $fieldsInfo; |
171 | 171 | } |
172 | 172 | |
173 | - protected function addFile($fieldsInfo, $entityName, $path, $output, $associated = false, $rootFolder,$configEntityName) |
|
173 | + protected function addFile($fieldsInfo, $entityName, $path, $output, $associated = false, $rootFolder, $configEntityName) |
|
174 | 174 | { |
175 | 175 | |
176 | 176 | $confgEntityReflection = new ReflectionClass($configEntityName); |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | $objectName = $entityReflection->getShortName(); |
183 | 183 | $lowerNameSpaceForTranslate = str_replace('bundle.entity', '', str_replace('\\', '.', strtolower($entityNamespace))); |
184 | 184 | |
185 | - $this->directory = $this->createDirectory($classPath, /*$entityNamespace*/$configEntityNamespace,$configEntityName, $objectName, $path, $rootFolder); |
|
186 | - $namespace = $this->createNameSpace($entityNamespace, $objectName, $path, $rootFolder,$configEntityName); |
|
185 | + $this->directory = $this->createDirectory($classPath, /*$entityNamespace*/$configEntityNamespace, $configEntityName, $objectName, $path, $rootFolder); |
|
186 | + $namespace = $this->createNameSpace($entityNamespace, $objectName, $path, $rootFolder, $configEntityName); |
|
187 | 187 | |
188 | 188 | $fileName = $this->directory . DIRECTORY_SEPARATOR . 'ListConfig.php'; |
189 | 189 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $output->writeln(sprintf("List config generated for <info>%s</info>", $entityName)); |
206 | 206 | } |
207 | 207 | |
208 | - protected function runAssociatedObjects($fieldsInfo, $analyzeFieldsInfo, $entityName, $rootPath, $rootFolder, $output,$configEntityName) |
|
208 | + protected function runAssociatedObjects($fieldsInfo, $analyzeFieldsInfo, $entityName, $rootPath, $rootFolder, $output, $configEntityName) |
|
209 | 209 | { |
210 | 210 | $associations = []; |
211 | 211 | foreach ($fieldsInfo as $key => $value) { |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | $arr = explode('\\', $value['object_name']); |
225 | 225 | $path = array_pop($arr); |
226 | 226 | |
227 | - $this->addFile($assocObjectAnalyzeFieldsInfo, $value['object_name'], $rootPath . DIRECTORY_SEPARATOR . $path, $output, TRUE, $rootFolder,$configEntityName); |
|
227 | + $this->addFile($assocObjectAnalyzeFieldsInfo, $value['object_name'], $rootPath . DIRECTORY_SEPARATOR . $path, $output, TRUE, $rootFolder, $configEntityName); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | - protected function getConfigEntityName($input,$output) |
|
232 | + protected function getConfigEntityName($input, $output) |
|
233 | 233 | { |
234 | 234 | $manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine')); |
235 | 235 | |
@@ -272,13 +272,13 @@ discard block |
||
272 | 272 | $analyzeFieldsInfo = $this->analizeFieldName($model->getFieldsInfo()); |
273 | 273 | |
274 | 274 | //configNameSpace |
275 | - $configEntityName=$this->getConfigEntityName($input,$output); |
|
275 | + $configEntityName = $this->getConfigEntityName($input, $output); |
|
276 | 276 | |
277 | - $this->addFile($analyzeFieldsInfo, $entityName, $path, $output, FALSE, $rootFolder,$configEntityName); |
|
277 | + $this->addFile($analyzeFieldsInfo, $entityName, $path, $output, FALSE, $rootFolder, $configEntityName); |
|
278 | 278 | |
279 | 279 | //generate assoc form types |
280 | 280 | if (true === $input->getOption('associated')) { |
281 | - $this->runAssociatedObjects($fieldsInfo, $analyzeFieldsInfo, $entityName, $path, $rootFolder, $output,$configEntityName); |
|
281 | + $this->runAssociatedObjects($fieldsInfo, $analyzeFieldsInfo, $entityName, $path, $rootFolder, $output, $configEntityName); |
|
282 | 282 | } |
283 | 283 | } |
284 | 284 |
@@ -45,6 +45,9 @@ discard block |
||
45 | 45 | ->addOption('withAssociated', null, InputOption::VALUE_NONE, 'Insert associated param'); |
46 | 46 | } |
47 | 47 | |
48 | + /** |
|
49 | + * @param InputInterface $input |
|
50 | + */ |
|
48 | 51 | protected function getConfigFilePath($manager, $input) |
49 | 52 | { |
50 | 53 | $bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('configBundle')); |
@@ -80,6 +83,11 @@ discard block |
||
80 | 83 | return false; |
81 | 84 | } |
82 | 85 | |
86 | + /** |
|
87 | + * @param string $search |
|
88 | + * @param string $replace |
|
89 | + * @param string $subject |
|
90 | + */ |
|
83 | 91 | protected function replaceLast($search, $replace, $subject) |
84 | 92 | { |
85 | 93 | $position = strrpos($subject, $search); |
@@ -89,6 +97,9 @@ discard block |
||
89 | 97 | return $subject; |
90 | 98 | } |
91 | 99 | |
100 | + /** |
|
101 | + * @param string $configFullPath |
|
102 | + */ |
|
92 | 103 | protected function readYml($configFullPath) |
93 | 104 | { |
94 | 105 | try { |
@@ -108,6 +119,10 @@ discard block |
||
108 | 119 | } |
109 | 120 | } |
110 | 121 | |
122 | + /** |
|
123 | + * @param string $fileName |
|
124 | + * @param OutputInterface $output |
|
125 | + */ |
|
111 | 126 | protected function writeYml($fileName, $yamlArr, $output) |
112 | 127 | { |
113 | 128 | |
@@ -119,6 +134,9 @@ discard block |
||
119 | 134 | $output->writeln("Services configuration file <info>" . $fileName . "</info> generated."); |
120 | 135 | } |
121 | 136 | |
137 | + /** |
|
138 | + * @param string $key |
|
139 | + */ |
|
122 | 140 | protected function checkServicesKeyExist($yamlArr, $key, $output) |
123 | 141 | { |
124 | 142 | $output->writeln("Check service key: <info>" . $key . "</info>."); |
@@ -128,6 +146,9 @@ discard block |
||
128 | 146 | return false; |
129 | 147 | } |
130 | 148 | |
149 | + /** |
|
150 | + * @param string $key |
|
151 | + */ |
|
131 | 152 | protected function checkParametersKeyExist($yamlArr, $key, $output) |
132 | 153 | { |
133 | 154 | $output->writeln("Check parameters key: <info>" . $key . "</info>."); |
@@ -209,6 +230,10 @@ discard block |
||
209 | 230 | return $parametersName; |
210 | 231 | } |
211 | 232 | |
233 | + /** |
|
234 | + * @param string $serviceName |
|
235 | + * @param string $class |
|
236 | + */ |
|
212 | 237 | protected function addGridConfigService(&$yamlArr, $serviceName, $class, $entity, $tag = '', $route = '', $parentEntity = '') |
213 | 238 | { |
214 | 239 | $yamlArr['services'][$serviceName] = [ |
@@ -218,6 +243,10 @@ discard block |
||
218 | 243 | ]; |
219 | 244 | } |
220 | 245 | |
246 | + /** |
|
247 | + * @param string $serviceName |
|
248 | + * @param string $class |
|
249 | + */ |
|
221 | 250 | protected function addListConfigService(&$yamlArr, $serviceName, $class, $entity, $tag = '', $route = '', $parentEntity = '') |
222 | 251 | { |
223 | 252 | $yamlArr['services'][$serviceName] = [ |
@@ -227,6 +256,10 @@ discard block |
||
227 | 256 | ]; |
228 | 257 | } |
229 | 258 | |
259 | + /** |
|
260 | + * @param string $serviceName |
|
261 | + * @param string $class |
|
262 | + */ |
|
230 | 263 | protected function addViewConfigService(&$yamlArr, $serviceName, $class, $entity, $tag = '', $route = '', $parentEntity = '') |
231 | 264 | { |
232 | 265 | $yamlArr['services'][$serviceName] = [ |
@@ -236,6 +269,10 @@ discard block |
||
236 | 269 | ]; |
237 | 270 | } |
238 | 271 | |
272 | + /** |
|
273 | + * @param string $serviceName |
|
274 | + * @param string $class |
|
275 | + */ |
|
239 | 276 | protected function addConfigService(&$yamlArr, $serviceName, $class, $entity, $tag = '', $route = '', $parentEntity = '', $parameterName = '') |
240 | 277 | { |
241 | 278 | $yamlArr['services'][$serviceName] = [ |
@@ -245,6 +282,10 @@ discard block |
||
245 | 282 | ]; |
246 | 283 | } |
247 | 284 | |
285 | + /** |
|
286 | + * @param string $serviceName |
|
287 | + * @param string $class |
|
288 | + */ |
|
248 | 289 | protected function addFormTypeService(&$yamlArr, $serviceName, $class, $entity, $tag = '', $route = '', $parentEntity = '') |
249 | 290 | { |
250 | 291 | $yamlArr['services'][$serviceName] = [ |
@@ -277,6 +318,10 @@ discard block |
||
277 | 318 | } |
278 | 319 | } |
279 | 320 | |
321 | + /** |
|
322 | + * @param string $tag |
|
323 | + * @param string $rootSpace |
|
324 | + */ |
|
280 | 325 | protected function createServiceName($entity, $tag, $associationName = null, $rootSpace = null) |
281 | 326 | { |
282 | 327 | |
@@ -335,6 +380,10 @@ discard block |
||
335 | 380 | return str_replace('.config', '', $parametersName); |
336 | 381 | } |
337 | 382 | |
383 | + /** |
|
384 | + * @param string $tag |
|
385 | + * @param string $rootSpace |
|
386 | + */ |
|
338 | 387 | protected function createClassName($entity, $tag, $configBundleName, $associationName = null, $rootSpace = null) |
339 | 388 | { |
340 | 389 | |
@@ -405,6 +454,13 @@ discard block |
||
405 | 454 | return $className; |
406 | 455 | } |
407 | 456 | |
457 | + /** |
|
458 | + * @param InputInterface $input |
|
459 | + * @param OutputInterface $output |
|
460 | + * @param string $objectName |
|
461 | + * @param null|string $configBundleName |
|
462 | + * @param string $routeName |
|
463 | + */ |
|
408 | 464 | protected function runAssociatedObjectsRecursively($fieldsInfo, &$yamlArr, $input, $output, $rootSpace, $objectName, $bundleName, $entity, $configBundleName, $routeName) |
409 | 465 | { |
410 | 466 | $associations = []; |
@@ -423,6 +479,10 @@ discard block |
||
423 | 479 | } |
424 | 480 | } |
425 | 481 | |
482 | + /** |
|
483 | + * @param InputInterface $input |
|
484 | + * @param OutputInterface $output |
|
485 | + */ |
|
426 | 486 | protected function getConfigBundleName($input, $output, $manager) |
427 | 487 | { |
428 | 488 |
@@ -485,7 +485,7 @@ |
||
485 | 485 | $yamlArr = $this->readYml($configFullPath); |
486 | 486 | |
487 | 487 | |
488 | - $applicationName=$input->getArgument('applicationName'); |
|
488 | + $applicationName = $input->getArgument('applicationName'); |
|
489 | 489 | |
490 | 490 | $routeName = strtolower($applicationName . '_' . $rootSpace . '_'); |
491 | 491 |
@@ -52,6 +52,9 @@ discard block |
||
52 | 52 | return $classPath; |
53 | 53 | } |
54 | 54 | |
55 | + /** |
|
56 | + * @param null|string $entityNamespace |
|
57 | + */ |
|
55 | 58 | protected function createTranslationDirectory($classPath, $entityNamespace) |
56 | 59 | { |
57 | 60 | |
@@ -75,6 +78,11 @@ discard block |
||
75 | 78 | return false; |
76 | 79 | } |
77 | 80 | |
81 | + /** |
|
82 | + * @param string $search |
|
83 | + * @param string $replace |
|
84 | + * @param string $subject |
|
85 | + */ |
|
78 | 86 | protected function replaceLast($search, $replace, $subject) |
79 | 87 | { |
80 | 88 | $position = strrpos($subject, $search); |
@@ -84,6 +92,9 @@ discard block |
||
84 | 92 | return $subject; |
85 | 93 | } |
86 | 94 | |
95 | + /** |
|
96 | + * @param string $configFullPath |
|
97 | + */ |
|
87 | 98 | protected function readYml($configFullPath) |
88 | 99 | { |
89 | 100 | try { |
@@ -103,6 +114,10 @@ discard block |
||
103 | 114 | } |
104 | 115 | } |
105 | 116 | |
117 | + /** |
|
118 | + * @param string $fileName |
|
119 | + * @param OutputInterface $output |
|
120 | + */ |
|
106 | 121 | protected function writeYml($fileName, $yamlArr, $output) |
107 | 122 | { |
108 | 123 | |
@@ -112,6 +127,10 @@ discard block |
||
112 | 127 | //$output->writeln("Services configuration file <info>" . $fileName . "</info> generated."); |
113 | 128 | } |
114 | 129 | |
130 | + /** |
|
131 | + * @param string $objectName |
|
132 | + * @param string $key |
|
133 | + */ |
|
115 | 134 | protected function checkKeyExist($yamlArr, $objectName, $key, $nameSpace) |
116 | 135 | { |
117 | 136 | |
@@ -153,6 +172,9 @@ discard block |
||
153 | 172 | } |
154 | 173 | } |
155 | 174 | |
175 | + /** |
|
176 | + * @param string $entityName |
|
177 | + */ |
|
156 | 178 | protected function getDefaultField($entityName) |
157 | 179 | { |
158 | 180 | try { |
@@ -169,6 +191,9 @@ discard block |
||
169 | 191 | } |
170 | 192 | } |
171 | 193 | |
194 | + /** |
|
195 | + * @param string $fieldName |
|
196 | + */ |
|
172 | 197 | protected function checkAssociation($entityName, $fieldName) |
173 | 198 | { |
174 | 199 | |
@@ -184,6 +209,9 @@ discard block |
||
184 | 209 | return false; |
185 | 210 | } |
186 | 211 | |
212 | + /** |
|
213 | + * @param string $lowerNameSpace |
|
214 | + */ |
|
187 | 215 | protected function addYamlData(&$yamlArr, $entityName, $manager, $lowerNameSpace) |
188 | 216 | { |
189 | 217 | |
@@ -220,6 +248,10 @@ discard block |
||
220 | 248 | } |
221 | 249 | } |
222 | 250 | |
251 | + /** |
|
252 | + * @param InputInterface $input |
|
253 | + * @param OutputInterface $output |
|
254 | + */ |
|
223 | 255 | protected function getConfigEntityNameSpace($input,$output,$manager) |
224 | 256 | { |
225 | 257 | $configEntityNamespace = null; |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | |
136 | 136 | |
137 | 137 | for ($z = 1; $z <= $i; $z++) { |
138 | - $yaml.="\x20\x20\x20\x20"; |
|
138 | + $yaml .= "\x20\x20\x20\x20"; |
|
139 | 139 | } |
140 | - $yaml.=$prefixEl . ": \n"; |
|
140 | + $yaml .= $prefixEl . ": \n"; |
|
141 | 141 | $i++; |
142 | 142 | } |
143 | 143 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
223 | - protected function getConfigEntityNameSpace($input,$output,$manager) |
|
223 | + protected function getConfigEntityNameSpace($input, $output, $manager) |
|
224 | 224 | { |
225 | 225 | $configEntityNamespace = null; |
226 | 226 | try { |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | |
263 | 263 | //configNameSpace |
264 | - $configEntityNamespace=$this->getConfigEntityNameSpace($input,$output,$manager); |
|
264 | + $configEntityNamespace = $this->getConfigEntityNameSpace($input, $output, $manager); |
|
265 | 265 | |
266 | 266 | // dump($configEntityNamespace); |
267 | 267 |
@@ -36,6 +36,9 @@ discard block |
||
36 | 36 | ->addArgument('rootFolder', InputArgument::OPTIONAL, 'Insert rootFolder'); |
37 | 37 | } |
38 | 38 | |
39 | + /** |
|
40 | + * @param InputInterface $input |
|
41 | + */ |
|
39 | 42 | protected function getEntityName($input) |
40 | 43 | { |
41 | 44 | $doctrine = $this->getContainer()->get('doctrine'); |
@@ -62,6 +65,10 @@ discard block |
||
62 | 65 | return implode("\\", $entityNameArr); |
63 | 66 | } |
64 | 67 | |
68 | + /** |
|
69 | + * @param string $entityNamespace |
|
70 | + * @param string $objectName |
|
71 | + */ |
|
65 | 72 | protected function createDirectory($classPath, $entityNamespace, $objectName, $rootFolder,$configEntityName) |
66 | 73 | { |
67 | 74 | |
@@ -89,6 +96,9 @@ discard block |
||
89 | 96 | return $fileName; |
90 | 97 | } |
91 | 98 | |
99 | + /** |
|
100 | + * @param string $fileName |
|
101 | + */ |
|
92 | 102 | protected function isFileNameBusy($fileName) |
93 | 103 | { |
94 | 104 | if (file_exists($fileName) == true) { |
@@ -97,6 +107,10 @@ discard block |
||
97 | 107 | return false; |
98 | 108 | } |
99 | 109 | |
110 | + /** |
|
111 | + * @param string $search |
|
112 | + * @param string $replace |
|
113 | + */ |
|
100 | 114 | protected function replaceLast($search, $replace, $subject) |
101 | 115 | { |
102 | 116 | $position = strrpos($subject, $search); |
@@ -124,6 +138,10 @@ discard block |
||
124 | 138 | return $associations; |
125 | 139 | } |
126 | 140 | |
141 | + /** |
|
142 | + * @param InputInterface $input |
|
143 | + * @param OutputInterface $output |
|
144 | + */ |
|
127 | 145 | protected function getConfigEntityName($input,$output) |
128 | 146 | { |
129 | 147 | $manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine')); |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | return implode("\\", $entityNameArr); |
63 | 63 | } |
64 | 64 | |
65 | - protected function createDirectory($classPath, $entityNamespace, $objectName, $rootFolder,$configEntityName) |
|
65 | + protected function createDirectory($classPath, $entityNamespace, $objectName, $rootFolder, $configEntityName) |
|
66 | 66 | { |
67 | 67 | |
68 | 68 | $confgEntityReflection = new ReflectionClass($configEntityName); |
69 | 69 | $configEntityNamespace = $confgEntityReflection->getNamespaceName(); |
70 | - $entityNamespace=$configEntityNamespace; |
|
70 | + $entityNamespace = $configEntityNamespace; |
|
71 | 71 | |
72 | 72 | $directory = str_replace("\\", DIRECTORY_SEPARATOR, ($classPath . "\\" . $entityNamespace)); |
73 | 73 | $directory = $this->replaceLast("Entity", "Resources" . DIRECTORY_SEPARATOR . "views" . DIRECTORY_SEPARATOR . $rootFolder . DIRECTORY_SEPARATOR . $objectName . DIRECTORY_SEPARATOR . "Container", $directory); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | return $associations; |
125 | 125 | } |
126 | 126 | |
127 | - protected function getConfigEntityName($input,$output) |
|
127 | + protected function getConfigEntityName($input, $output) |
|
128 | 128 | { |
129 | 129 | $manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine')); |
130 | 130 | |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | $classPath = $this->getClassPath($entityName); |
166 | 166 | |
167 | 167 | //configNameSpace |
168 | - $configEntityName=$this->getConfigEntityName($input,$output); |
|
168 | + $configEntityName = $this->getConfigEntityName($input, $output); |
|
169 | 169 | |
170 | 170 | $entityReflection = new ReflectionClass($entityName); |
171 | 171 | $entityNamespace = $entityReflection->getNamespaceName(); |
172 | 172 | $objectName = $entityReflection->getShortName(); |
173 | - $directory = $this->createDirectory($classPath, $entityNamespace, $objectName, $rootFolder,$configEntityName); |
|
173 | + $directory = $this->createDirectory($classPath, $entityNamespace, $objectName, $rootFolder, $configEntityName); |
|
174 | 174 | $fileName = $directory . DIRECTORY_SEPARATOR . "create.html.twig"; |
175 | 175 | $this->isFileNameBusy($fileName); |
176 | 176 | $templating = $this->getContainer()->get('templating'); |
177 | 177 | $associations = $this->getAssociatedObjects($fieldsInfo); |
178 | - $classmapperservice=$this->getContainer()->get("classmapperservice"); |
|
178 | + $classmapperservice = $this->getContainer()->get("classmapperservice"); |
|
179 | 179 | |
180 | 180 | |
181 | 181 | $renderedConfig = $templating->render("CorePrototypeBundle:Command:container.create.template.twig", [ |
@@ -36,6 +36,9 @@ discard block |
||
36 | 36 | ->addArgument('rootFolder', InputArgument::OPTIONAL, 'Insert rootFolder'); |
37 | 37 | } |
38 | 38 | |
39 | + /** |
|
40 | + * @param InputInterface $input |
|
41 | + */ |
|
39 | 42 | protected function getEntityName($input) |
40 | 43 | { |
41 | 44 | $doctrine = $this->getContainer()->get('doctrine'); |
@@ -62,6 +65,10 @@ discard block |
||
62 | 65 | return implode("\\", $entityNameArr); |
63 | 66 | } |
64 | 67 | |
68 | + /** |
|
69 | + * @param string $entityNamespace |
|
70 | + * @param string $objectName |
|
71 | + */ |
|
65 | 72 | protected function createDirectory($classPath, $entityNamespace, $objectName, $rootFolder,$configEntityName) |
66 | 73 | { |
67 | 74 | |
@@ -89,6 +96,9 @@ discard block |
||
89 | 96 | return $fileName; |
90 | 97 | } |
91 | 98 | |
99 | + /** |
|
100 | + * @param string $fileName |
|
101 | + */ |
|
92 | 102 | protected function isFileNameBusy($fileName) |
93 | 103 | { |
94 | 104 | if (file_exists($fileName) == true) { |
@@ -97,6 +107,10 @@ discard block |
||
97 | 107 | return false; |
98 | 108 | } |
99 | 109 | |
110 | + /** |
|
111 | + * @param string $search |
|
112 | + * @param string $replace |
|
113 | + */ |
|
100 | 114 | protected function replaceLast($search, $replace, $subject) |
101 | 115 | { |
102 | 116 | $position = strrpos($subject, $search); |
@@ -124,6 +138,10 @@ discard block |
||
124 | 138 | return $associations; |
125 | 139 | } |
126 | 140 | |
141 | + /** |
|
142 | + * @param InputInterface $input |
|
143 | + * @param OutputInterface $output |
|
144 | + */ |
|
127 | 145 | protected function getConfigEntityName($input,$output) |
128 | 146 | { |
129 | 147 | $manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine')); |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | return implode("\\", $entityNameArr); |
63 | 63 | } |
64 | 64 | |
65 | - protected function createDirectory($classPath, $entityNamespace, $objectName, $rootFolder,$configEntityName) |
|
65 | + protected function createDirectory($classPath, $entityNamespace, $objectName, $rootFolder, $configEntityName) |
|
66 | 66 | { |
67 | 67 | |
68 | 68 | $confgEntityReflection = new ReflectionClass($configEntityName); |
69 | 69 | $configEntityNamespace = $confgEntityReflection->getNamespaceName(); |
70 | - $entityNamespace=$configEntityNamespace; |
|
70 | + $entityNamespace = $configEntityNamespace; |
|
71 | 71 | |
72 | 72 | $directory = str_replace("\\", DIRECTORY_SEPARATOR, ($classPath . "\\" . $entityNamespace)); |
73 | 73 | $directory = $this->replaceLast("Entity", "Resources" . DIRECTORY_SEPARATOR . "views" . DIRECTORY_SEPARATOR . $rootFolder . DIRECTORY_SEPARATOR . $objectName . DIRECTORY_SEPARATOR . "Container", $directory); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | return $associations; |
125 | 125 | } |
126 | 126 | |
127 | - protected function getConfigEntityName($input,$output) |
|
127 | + protected function getConfigEntityName($input, $output) |
|
128 | 128 | { |
129 | 129 | $manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine')); |
130 | 130 | |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | $classPath = $this->getClassPath($entityName); |
166 | 166 | |
167 | 167 | //configNameSpace |
168 | - $configEntityName=$this->getConfigEntityName($input,$output); |
|
168 | + $configEntityName = $this->getConfigEntityName($input, $output); |
|
169 | 169 | |
170 | 170 | $entityReflection = new ReflectionClass($entityName); |
171 | 171 | $entityNamespace = $entityReflection->getNamespaceName(); |
172 | 172 | $objectName = $entityReflection->getShortName(); |
173 | - $directory = $this->createDirectory($classPath, $entityNamespace, $objectName, $rootFolder,$configEntityName); |
|
173 | + $directory = $this->createDirectory($classPath, $entityNamespace, $objectName, $rootFolder, $configEntityName); |
|
174 | 174 | $fileName = $directory . DIRECTORY_SEPARATOR . "grid.html.twig"; |
175 | 175 | $this->isFileNameBusy($fileName); |
176 | 176 | $templating = $this->getContainer()->get('templating'); |
177 | 177 | $associations = $this->getAssociatedObjects($fieldsInfo); |
178 | - $classmapperservice=$this->getContainer()->get("classmapperservice"); |
|
178 | + $classmapperservice = $this->getContainer()->get("classmapperservice"); |
|
179 | 179 | |
180 | 180 | |
181 | 181 | $renderedConfig = $templating->render("CorePrototypeBundle:Command:container.grid.template.twig", [ |
@@ -36,6 +36,9 @@ discard block |
||
36 | 36 | ->addArgument('rootFolder', InputArgument::OPTIONAL, 'Insert rootFolder'); |
37 | 37 | } |
38 | 38 | |
39 | + /** |
|
40 | + * @param InputInterface $input |
|
41 | + */ |
|
39 | 42 | protected function getEntityName($input) |
40 | 43 | { |
41 | 44 | $doctrine = $this->getContainer()->get('doctrine'); |
@@ -62,6 +65,10 @@ discard block |
||
62 | 65 | return implode("\\", $entityNameArr); |
63 | 66 | } |
64 | 67 | |
68 | + /** |
|
69 | + * @param string $entityNamespace |
|
70 | + * @param string $objectName |
|
71 | + */ |
|
65 | 72 | protected function createDirectory($classPath, $entityNamespace, $objectName, $rootFolder,$configEntityName) |
66 | 73 | { |
67 | 74 | |
@@ -89,6 +96,9 @@ discard block |
||
89 | 96 | return $fileName; |
90 | 97 | } |
91 | 98 | |
99 | + /** |
|
100 | + * @param string $fileName |
|
101 | + */ |
|
92 | 102 | protected function isFileNameBusy($fileName) |
93 | 103 | { |
94 | 104 | if (file_exists($fileName) == true) { |
@@ -97,6 +107,10 @@ discard block |
||
97 | 107 | return false; |
98 | 108 | } |
99 | 109 | |
110 | + /** |
|
111 | + * @param string $search |
|
112 | + * @param string $replace |
|
113 | + */ |
|
100 | 114 | protected function replaceLast($search, $replace, $subject) |
101 | 115 | { |
102 | 116 | $position = strrpos($subject, $search); |
@@ -124,6 +138,10 @@ discard block |
||
124 | 138 | return $associations; |
125 | 139 | } |
126 | 140 | |
141 | + /** |
|
142 | + * @param InputInterface $input |
|
143 | + * @param OutputInterface $output |
|
144 | + */ |
|
127 | 145 | protected function getConfigEntityName($input,$output) |
128 | 146 | { |
129 | 147 | $manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine')); |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | return implode("\\", $entityNameArr); |
63 | 63 | } |
64 | 64 | |
65 | - protected function createDirectory($classPath, $entityNamespace, $objectName, $rootFolder,$configEntityName) |
|
65 | + protected function createDirectory($classPath, $entityNamespace, $objectName, $rootFolder, $configEntityName) |
|
66 | 66 | { |
67 | 67 | |
68 | 68 | $confgEntityReflection = new ReflectionClass($configEntityName); |
69 | 69 | $configEntityNamespace = $confgEntityReflection->getNamespaceName(); |
70 | - $entityNamespace=$configEntityNamespace; |
|
70 | + $entityNamespace = $configEntityNamespace; |
|
71 | 71 | |
72 | 72 | $directory = str_replace("\\", DIRECTORY_SEPARATOR, ($classPath . "\\" . $entityNamespace)); |
73 | 73 | $directory = $this->replaceLast("Entity", "Resources" . DIRECTORY_SEPARATOR . "views" . DIRECTORY_SEPARATOR . $rootFolder . DIRECTORY_SEPARATOR . $objectName . DIRECTORY_SEPARATOR . "Container", $directory); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | return $associations; |
125 | 125 | } |
126 | 126 | |
127 | - protected function getConfigEntityName($input,$output) |
|
127 | + protected function getConfigEntityName($input, $output) |
|
128 | 128 | { |
129 | 129 | $manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine')); |
130 | 130 | |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | $classPath = $this->getClassPath($entityName); |
166 | 166 | |
167 | 167 | //configNameSpace |
168 | - $configEntityName=$this->getConfigEntityName($input,$output); |
|
168 | + $configEntityName = $this->getConfigEntityName($input, $output); |
|
169 | 169 | |
170 | 170 | $entityReflection = new ReflectionClass($entityName); |
171 | 171 | $entityNamespace = $entityReflection->getNamespaceName(); |
172 | 172 | $objectName = $entityReflection->getShortName(); |
173 | - $directory = $this->createDirectory($classPath, $entityNamespace, $objectName, $rootFolder,$configEntityName); |
|
173 | + $directory = $this->createDirectory($classPath, $entityNamespace, $objectName, $rootFolder, $configEntityName); |
|
174 | 174 | $fileName = $directory . DIRECTORY_SEPARATOR . "list.html.twig"; |
175 | 175 | $this->isFileNameBusy($fileName); |
176 | 176 | $templating = $this->getContainer()->get('templating'); |
177 | 177 | $associations = $this->getAssociatedObjects($fieldsInfo); |
178 | - $classmapperservice=$this->getContainer()->get("classmapperservice"); |
|
178 | + $classmapperservice = $this->getContainer()->get("classmapperservice"); |
|
179 | 179 | |
180 | 180 | |
181 | 181 | $renderedConfig = $templating->render("CorePrototypeBundle:Command:container.list.template.twig", [ |