Skip to content
This repository
Browse code

Merge branch 'hotfix/3742' into develop

Forward port #3742
  • Loading branch information...
commit 1db2535c759b4c0491dba14675c6e72fd70573ba 2 parents 0823436 + f3eb430
Matthew Weier O'Phinney authored February 19, 2013
6  library/Zend/Form/Annotation/ElementAnnotationsListener.php
@@ -234,8 +234,8 @@ public function handleHydratorAnnotation($e)
234 234
             return;
235 235
         }
236 236
 
237  
-        $elementSpec = $e->getParam('element');
238  
-        $elementSpec['hydrator'] = $annotation->getHydrator();
  237
+        $elementSpec = $e->getParam('elementSpec');
  238
+        $elementSpec['spec']['hydrator'] = $annotation->getHydrator();
239 239
     }
240 240
 
241 241
     /**
@@ -275,7 +275,7 @@ public function handleObjectAnnotation($e)
275 275
         }
276 276
 
277 277
         $elementSpec = $e->getParam('elementSpec');
278  
-        $elementSpec['object'] = $annotation->getObject();
  278
+        $elementSpec['spec']['object'] = $annotation->getObject();
279 279
     }
280 280
 
281 281
     /**
15  tests/ZendTest/Form/Annotation/AnnotationBuilderTest.php
@@ -218,4 +218,19 @@ public function testAllowEmptyInput()
218 218
         $sampleinput = $inputFilter->get('sampleinput');
219 219
         $this->assertTrue($sampleinput->allowEmpty());
220 220
     }
  221
+
  222
+    public function testObjectElementAnnotation()
  223
+    {
  224
+        $entity = new TestAsset\Annotation\EntityUsingObjectProperty();
  225
+        $builder = new Annotation\AnnotationBuilder();
  226
+        $form = $builder->createForm($entity);
  227
+
  228
+        $fieldset = $form->get('object');
  229
+        /* @var $fieldset Zend\Form\Fieldset */
  230
+
  231
+        $this->assertInstanceOf('Zend\Form\Fieldset',$fieldset);
  232
+        $this->assertInstanceOf('ZendTest\Form\TestAsset\Annotation\Entity',$fieldset->getObject());
  233
+        $this->assertInstanceOf("Zend\Stdlib\Hydrator\ClassMethods",$fieldset->getHydrator());
  234
+        $this->assertFalse($fieldset->getHydrator()->getUnderscoreSeparatedKeys());
  235
+    }
221 236
 }
26  tests/ZendTest/Form/TestAsset/Annotation/EntityUsingObjectProperty.php
... ...
@@ -0,0 +1,26 @@
  1
+<?php
  2
+/**
  3
+* Zend Framework (http://framework.zend.com/)
  4
+*
  5
+* @link http://github.com/zendframework/zf2 for the canonical source repository
  6
+* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
  7
+* @license http://framework.zend.com/license/new-bsd New BSD License
  8
+* @package Zend_Form
  9
+*/
  10
+
  11
+namespace ZendTest\Form\TestAsset\Annotation;
  12
+
  13
+use Zend\Form\Annotation;
  14
+
  15
+/**
  16
+* @Annotation\Options({"use_as_base_fieldset":true})
  17
+*/
  18
+class EntityUsingObjectProperty
  19
+{
  20
+    /**
  21
+* @Annotation\Object("ZendTest\Form\TestAsset\Annotation\Entity")
  22
+* @Annotation\Type("Zend\Form\Fieldset")
  23
+* @Annotation\Hydrator({"type":"Zend\Stdlib\Hydrator\ClassMethods", "options": {"underscoreSeparatedKeys": false}})
  24
+*/
  25
+    public $object;
  26
+}

0 notes on commit 1db2535

Please sign in to comment.
Something went wrong with that request. Please try again.