@@ -17,18 +17,22 @@ |
||
17 | 17 | |
18 | 18 | $builder->addCompilerPass(new LazyServiceMapPass('tpg_extjs.serialization_visitor', 'format', |
19 | 19 | function(ContainerBuilder $container, Definition $def) { |
20 | - if ($container->hasDefinition("tpg_extjs.orm_serializer")) |
|
21 | - $container->getDefinition('tpg_extjs.orm_serializer')->replaceArgument(3, $def); |
|
22 | - if ($container->hasDefinition("tpg_extjs.odm_serializer")) |
|
23 | - $container->getDefinition('tpg_extjs.odm_serializer')->replaceArgument(3, $def); |
|
20 | + if ($container->hasDefinition("tpg_extjs.orm_serializer")) { |
|
21 | + $container->getDefinition('tpg_extjs.orm_serializer')->replaceArgument(3, $def); |
|
22 | + } |
|
23 | + if ($container->hasDefinition("tpg_extjs.odm_serializer")) { |
|
24 | + $container->getDefinition('tpg_extjs.odm_serializer')->replaceArgument(3, $def); |
|
25 | + } |
|
24 | 26 | } |
25 | 27 | )); |
26 | 28 | $builder->addCompilerPass(new LazyServiceMapPass('tpg_extjs.deserialization_visitor', 'format', |
27 | 29 | function(ContainerBuilder $container, Definition $def) { |
28 | - if ($container->hasDefinition("tpg_extjs.orm_serializer")) |
|
29 | - $container->getDefinition('tpg_extjs.orm_serializer')->replaceArgument(4, $def); |
|
30 | - if ($container->hasDefinition("tpg_extjs.odm_serializer")) |
|
31 | - $container->getDefinition('tpg_extjs.odm_serializer')->replaceArgument(4, $def); |
|
30 | + if ($container->hasDefinition("tpg_extjs.orm_serializer")) { |
|
31 | + $container->getDefinition('tpg_extjs.orm_serializer')->replaceArgument(4, $def); |
|
32 | + } |
|
33 | + if ($container->hasDefinition("tpg_extjs.odm_serializer")) { |
|
34 | + $container->getDefinition('tpg_extjs.odm_serializer')->replaceArgument(4, $def); |
|
35 | + } |
|
32 | 36 | } |
33 | 37 | )); |
34 | 38 |
@@ -27,7 +27,9 @@ |
||
27 | 27 | $classMetadata = $e->getContext()->getMetadataFactory()->getMetadataForClass($className); |
28 | 28 | /** @var PropertyMetadata $propertyMetadata */ |
29 | 29 | foreach ($classMetadata->propertyMetadata as $propertyMetadata) { |
30 | - if ($propertyMetadata->reflection === null) continue; |
|
30 | + if ($propertyMetadata->reflection === null) { |
|
31 | + continue; |
|
32 | + } |
|
31 | 33 | /** @var JoinColumn $joinColumnAnnotation */ |
32 | 34 | $joinColumnAnnotation = $this->reader->getPropertyAnnotation( |
33 | 35 | $propertyMetadata->reflection, |
@@ -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 | /** |