@@ -18,6 +18,9 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | protected $entityBundle; |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param string $name |
|
| 23 | + */ |
|
| 21 | 24 | public function setEntityName($name) { |
| 22 | 25 | $this->entityName = $name; |
| 23 | 26 | } |
@@ -25,18 +28,32 @@ discard block |
||
| 25 | 28 | $this->entityBundle = $bundle; |
| 26 | 29 | } |
| 27 | 30 | |
| 31 | + /** |
|
| 32 | + * @param boolean $flag |
|
| 33 | + */ |
|
| 28 | 34 | public function setUseTrait($flag) { |
| 29 | 35 | $this->trait = $flag; |
| 30 | 36 | } |
| 31 | 37 | |
| 38 | + /** |
|
| 39 | + * @param string $file |
|
| 40 | + */ |
|
| 32 | 41 | public function setTemplateFile($file) { |
| 33 | 42 | $this->template = $file; |
| 34 | 43 | } |
| 35 | 44 | |
| 45 | + /** |
|
| 46 | + * @param boolean $mongo |
|
| 47 | + */ |
|
| 36 | 48 | public function setMongo($mongo) { |
| 37 | 49 | $this->mongo = $mongo; |
| 38 | 50 | } |
| 39 | 51 | |
| 52 | + /** |
|
| 53 | + * @param string $controller |
|
| 54 | + * @param string $routeFormat |
|
| 55 | + * @param string $templateFormat |
|
| 56 | + */ |
|
| 40 | 57 | public function generate(BundleInterface $bundle, $controller, $routeFormat, $templateFormat, array $actions = array()) |
| 41 | 58 | { |
| 42 | 59 | $dir = $bundle->getPath(); |
@@ -27,10 +27,16 @@ discard block |
||
| 27 | 27 | protected $remotingBundles = array(); |
| 28 | 28 | protected $fieldsParams = array(); |
| 29 | 29 | |
| 30 | + /** |
|
| 31 | + * @param AnnotationReader $reader |
|
| 32 | + */ |
|
| 30 | 33 | public function setAnnotationReader($reader) { |
| 31 | 34 | $this->annoReader = $reader; |
| 32 | 35 | } |
| 33 | 36 | |
| 37 | + /** |
|
| 38 | + * @param \Test\TestBundle\Mockup\TwigEngineMokcup $engine |
|
| 39 | + */ |
|
| 34 | 40 | public function setTwigEngine($engine) { |
| 35 | 41 | $this->twig = $engine; |
| 36 | 42 | } |
@@ -127,6 +133,9 @@ discard block |
||
| 127 | 133 | } |
| 128 | 134 | } |
| 129 | 135 | |
| 136 | + /** |
|
| 137 | + * @param string $name |
|
| 138 | + */ |
|
| 130 | 139 | protected function convertNaming($name) { |
| 131 | 140 | return $name; |
| 132 | 141 | } |
@@ -351,9 +360,9 @@ discard block |
||
| 351 | 360 | |
| 352 | 361 | /** |
| 353 | 362 | * Get Annotation |
| 354 | - * @param $entity |
|
| 355 | - * @param $property |
|
| 356 | - * @param $annotation |
|
| 363 | + * @param string $entity |
|
| 364 | + * @param string $property |
|
| 365 | + * @param string $annotation |
|
| 357 | 366 | * @return Annotation|null |
| 358 | 367 | */ |
| 359 | 368 | protected function getAnnotation($entity, $property, $annotation) { |
@@ -367,7 +376,7 @@ discard block |
||
| 367 | 376 | * Get Column Type of a model. |
| 368 | 377 | * |
| 369 | 378 | * @param $entity string Class name of the entity |
| 370 | - * @param $property string |
|
| 379 | + * @param string $property string |
|
| 371 | 380 | * @return string |
| 372 | 381 | */ |
| 373 | 382 | public function getEntityColumnType($entity, $property) { |
@@ -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 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | /** |
| 96 | 96 | * Add orders |
| 97 | 97 | * |
| 98 | - * @param Test\TestBundle\Document\Order $orders |
|
| 98 | + * @param Order $orders |
|
| 99 | 99 | * |
| 100 | 100 | * @return $this |
| 101 | 101 | */ |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | /** |
| 110 | 110 | * Remove orders |
| 111 | 111 | * |
| 112 | - * @param Test\TestBundle\Document\Order $orders |
|
| 112 | + * @param Order $orders |
|
| 113 | 113 | */ |
| 114 | 114 | public function removeOrder(\Test\TestBundle\Document\Order $orders) |
| 115 | 115 | { |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * Get orders |
| 122 | 122 | * |
| 123 | - * @return Doctrine\Common\Collections\Collection $orders |
|
| 123 | + * @return \Doctrine\Common\Collections\ArrayCollection $orders |
|
| 124 | 124 | */ |
| 125 | 125 | public function getOrders() |
| 126 | 126 | { |
@@ -48,8 +48,6 @@ |
||
| 48 | 48 | /** |
| 49 | 49 | * Inject ExtJs Model into the DOM. |
| 50 | 50 | * |
| 51 | - * @param boolean $injection Produce ExtJS model code on the page directly? |
|
| 52 | - * @param string $model Model Name. |
|
| 53 | 51 | */ |
| 54 | 52 | public function injectModel() { |
| 55 | 53 | $params = func_get_args(); |
@@ -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, |