@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function generateRemotingApi() { |
49 | 49 | $list = array(); |
50 | - foreach($this->remotingBundles as $bundle) { |
|
50 | + foreach ($this->remotingBundles as $bundle) { |
|
51 | 51 | $bundleRef = new \ReflectionClass($bundle); |
52 | 52 | $controllerDir = new Finder(); |
53 | 53 | $controllerDir->files()->in(dirname($bundleRef->getFileName()).'/Controller/')->name('/.*Controller\.php$/'); |
54 | - foreach($controllerDir as $controllerFile) { |
|
55 | - $controller = $bundleRef->getNamespaceName() . "\\Controller\\" . substr($controllerFile->getFilename(), 0, -4); |
|
54 | + foreach ($controllerDir as $controllerFile) { |
|
55 | + $controller = $bundleRef->getNamespaceName()."\\Controller\\".substr($controllerFile->getFilename(), 0, -4); |
|
56 | 56 | $controllerRef = new \ReflectionClass($controller); |
57 | 57 | foreach ($controllerRef->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { |
58 | 58 | /** @var $methodDirectAnnotation Direct */ |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $modelName = str_replace("\\", ".", $classRef->getName()); |
85 | 85 | } |
86 | 86 | if ($classModelAnnotation->generateAsBase === true) { |
87 | - $modelName = substr($modelName, 0, strrpos($modelName, '.')+1) . 'Base' . substr($modelName, strrpos($modelName, '.')+1); |
|
87 | + $modelName = substr($modelName, 0, strrpos($modelName, '.') + 1).'Base'.substr($modelName, strrpos($modelName, '.') + 1); |
|
88 | 88 | } |
89 | 89 | $structure = array( |
90 | 90 | 'name' => $modelName, |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | if (strpos(get_class($annotation), 'Symfony\Component\Validator\Constraints') === 0) { |
154 | 154 | $validators[] = array_merge( |
155 | 155 | array('field'=>$this->convertNaming($property->getName())), |
156 | - $this->getValidator(substr($className, 40),$annotation) |
|
156 | + $this->getValidator(substr($className, 40), $annotation) |
|
157 | 157 | ); |
158 | 158 | } |
159 | - switch(get_class($annotation)) { |
|
159 | + switch (get_class($annotation)) { |
|
160 | 160 | case 'Tpg\ExtjsBundle\Annotation\Model\Field': |
161 | 161 | $field['type'] = $annotation->type; |
162 | 162 | break; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $format = explode(',', |
210 | 210 | substr( |
211 | 211 | $type, |
212 | - stripos($type, '<')+2, |
|
212 | + stripos($type, '<') + 2, |
|
213 | 213 | -2 |
214 | 214 | ) |
215 | 215 | ); |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | $field['type'] = $this->getEntityColumnType($association['entity'], $annotation->referencedColumnName); |
274 | 274 | $field['useNull'] = true; |
275 | 275 | $association['key'] = $this->convertNaming($annotation->name); |
276 | - $field['mapping'] = $property->getName() . '.' . $annotation->referencedColumnName; |
|
276 | + $field['mapping'] = $property->getName().'.'.$annotation->referencedColumnName; |
|
277 | 277 | break; |
278 | 278 | } |
279 | 279 | } |
280 | - if($fieldIsId){ |
|
280 | + if ($fieldIsId) { |
|
281 | 281 | $structure['idProperty'] = $field['name']; |
282 | 282 | } |
283 | 283 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @throws \Exception |
310 | 310 | * @return string |
311 | 311 | */ |
312 | - protected function tryToGetJoinColumnNameOfMappedBy($annotation){ |
|
312 | + protected function tryToGetJoinColumnNameOfMappedBy($annotation) { |
|
313 | 313 | $annotation = $this->tryToGetJoinColumnAnnotationOfMappedBy($annotation); |
314 | 314 | if ($annotation !== null) { |
315 | 315 | if ($annotation instanceof JoinColumn) { |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | * @param OneToMany $annotation |
330 | 330 | * @return null|Annotation |
331 | 331 | */ |
332 | - protected function tryToGetJoinColumnAnnotationOfMappedBy($annotation){ |
|
332 | + protected function tryToGetJoinColumnAnnotationOfMappedBy($annotation) { |
|
333 | 333 | $result = null; |
334 | - if($annotation->targetEntity && $annotation->mappedBy) { |
|
334 | + if ($annotation->targetEntity && $annotation->mappedBy) { |
|
335 | 335 | $result = $this->getAnnotation( |
336 | 336 | $annotation->targetEntity, |
337 | 337 | $annotation->mappedBy, |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | */ |
458 | 458 | protected function getValidator($name, $annotation) { |
459 | 459 | $validate = array(); |
460 | - switch($name) { |
|
460 | + switch ($name) { |
|
461 | 461 | case 'NotBlank': |
462 | 462 | case 'NotNull': |
463 | 463 | $validate['type'] = "presence"; |
@@ -467,8 +467,8 @@ discard block |
||
467 | 467 | break; |
468 | 468 | case 'Length': |
469 | 469 | $validate['type'] = "length"; |
470 | - $validate['max'] = (int)$annotation->max; |
|
471 | - $validate['min'] = (int)$annotation->min; |
|
470 | + $validate['max'] = (int) $annotation->max; |
|
471 | + $validate['min'] = (int) $annotation->min; |
|
472 | 472 | break; |
473 | 473 | case 'Regex': |
474 | 474 | if ($annotation->match) { |
@@ -481,9 +481,9 @@ discard block |
||
481 | 481 | case 'MinLength': |
482 | 482 | $validate['type'] = "length"; |
483 | 483 | if ($name == "MaxLength") { |
484 | - $validate['max'] = (int)$annotation->limit; |
|
484 | + $validate['max'] = (int) $annotation->limit; |
|
485 | 485 | } else { |
486 | - $validate['min'] = (int)$annotation->limit; |
|
486 | + $validate['min'] = (int) $annotation->limit; |
|
487 | 487 | } |
488 | 488 | break; |
489 | 489 | case 'Choice': |
@@ -98,8 +98,12 @@ discard block |
||
98 | 98 | $structure['proxy'] = array( |
99 | 99 | 'type'=>$classModelProxyAnnotation->name, |
100 | 100 | ) + $classModelProxyAnnotation->option; |
101 | - if ($classModelProxyAnnotation->reader != array()) $structure['proxy']['reader'] = $classModelProxyAnnotation->reader; |
|
102 | - if ($classModelProxyAnnotation->writer != array()) $structure['proxy']['writer'] = $classModelProxyAnnotation->writer; |
|
101 | + if ($classModelProxyAnnotation->reader != array()) { |
|
102 | + $structure['proxy']['reader'] = $classModelProxyAnnotation->reader; |
|
103 | + } |
|
104 | + if ($classModelProxyAnnotation->writer != array()) { |
|
105 | + $structure['proxy']['writer'] = $classModelProxyAnnotation->writer; |
|
106 | + } |
|
103 | 107 | } |
104 | 108 | /** @var $classExclusionPolicy ExclusionPolicy */ |
105 | 109 | $classExclusionPolicy = $this->annoReader->getClassAnnotation($classRef, 'JMS\Serializer\Annotation\ExclusionPolicy'); |
@@ -222,8 +226,9 @@ discard block |
||
222 | 226 | $association['name'] = $property->getName(); |
223 | 227 | $association['model'] = $this->getModelName($annotation->targetEntity); |
224 | 228 | $association['entity'] = $annotation->targetEntity; |
225 | - if (!isset($association['key']) || empty($association['key'])) |
|
226 | - $association['key'] = $this->tryToGetJoinColumnNameOfMappedBy($annotation); |
|
229 | + if (!isset($association['key']) || empty($association['key'])) { |
|
230 | + $association['key'] = $this->tryToGetJoinColumnNameOfMappedBy($annotation); |
|
231 | + } |
|
227 | 232 | break; |
228 | 233 | case 'Doctrine\ORM\Mapping\OneToMany': |
229 | 234 | $association['type'] = substr(get_class($annotation), 21); |
@@ -358,8 +363,11 @@ discard block |
||
358 | 363 | protected function getAnnotation($entity, $property, $annotation) { |
359 | 364 | $classRef = new \ReflectionClass($entity); |
360 | 365 | $propertyRef = $classRef->getProperty($property); |
361 | - if ($propertyRef) return $this->annoReader->getPropertyAnnotation($propertyRef, $annotation); |
|
362 | - else return null; |
|
366 | + if ($propertyRef) { |
|
367 | + return $this->annoReader->getPropertyAnnotation($propertyRef, $annotation); |
|
368 | + } else { |
|
369 | + return null; |
|
370 | + } |
|
363 | 371 | } |
364 | 372 | |
365 | 373 | /** |