Permalink
Browse files

Merge branch 'hotfix/3742' into develop

Forward port #3742
  • Loading branch information...
2 parents 0823436 + f3eb430 commit 1db2535c759b4c0491dba14675c6e72fd70573ba @weierophinney weierophinney committed Feb 19, 2013
View
6 library/Zend/Form/Annotation/ElementAnnotationsListener.php
@@ -234,8 +234,8 @@ public function handleHydratorAnnotation($e)
return;
}
- $elementSpec = $e->getParam('element');
- $elementSpec['hydrator'] = $annotation->getHydrator();
+ $elementSpec = $e->getParam('elementSpec');
+ $elementSpec['spec']['hydrator'] = $annotation->getHydrator();
}
/**
@@ -275,7 +275,7 @@ public function handleObjectAnnotation($e)
}
$elementSpec = $e->getParam('elementSpec');
- $elementSpec['object'] = $annotation->getObject();
+ $elementSpec['spec']['object'] = $annotation->getObject();
}
/**
View
15 tests/ZendTest/Form/Annotation/AnnotationBuilderTest.php
@@ -218,4 +218,19 @@ public function testAllowEmptyInput()
$sampleinput = $inputFilter->get('sampleinput');
$this->assertTrue($sampleinput->allowEmpty());
}
+
+ public function testObjectElementAnnotation()
+ {
+ $entity = new TestAsset\Annotation\EntityUsingObjectProperty();
+ $builder = new Annotation\AnnotationBuilder();
+ $form = $builder->createForm($entity);
+
+ $fieldset = $form->get('object');
+ /* @var $fieldset Zend\Form\Fieldset */
+
+ $this->assertInstanceOf('Zend\Form\Fieldset',$fieldset);
+ $this->assertInstanceOf('ZendTest\Form\TestAsset\Annotation\Entity',$fieldset->getObject());
+ $this->assertInstanceOf("Zend\Stdlib\Hydrator\ClassMethods",$fieldset->getHydrator());
+ $this->assertFalse($fieldset->getHydrator()->getUnderscoreSeparatedKeys());
+ }
}
View
26 tests/ZendTest/Form/TestAsset/Annotation/EntityUsingObjectProperty.php
@@ -0,0 +1,26 @@
+<?php
+/**
+* Zend Framework (http://framework.zend.com/)
+*
+* @link http://github.com/zendframework/zf2 for the canonical source repository
+* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
+* @license http://framework.zend.com/license/new-bsd New BSD License
+* @package Zend_Form
+*/
+
+namespace ZendTest\Form\TestAsset\Annotation;
+
+use Zend\Form\Annotation;
+
+/**
+* @Annotation\Options({"use_as_base_fieldset":true})
+*/
+class EntityUsingObjectProperty
+{
+ /**
+* @Annotation\Object("ZendTest\Form\TestAsset\Annotation\Entity")
+* @Annotation\Type("Zend\Form\Fieldset")
+* @Annotation\Hydrator({"type":"Zend\Stdlib\Hydrator\ClassMethods", "options": {"underscoreSeparatedKeys": false}})
+*/
+ public $object;
+}

0 comments on commit 1db2535

Please sign in to comment.