Fix input annotation handler in Zend/Form/Annotation/ElementAnnotationsListener #5031

Closed
wants to merge 9 commits into
from
Jump to file
+56 −20
View
5 library/Zend/Form/Annotation/ElementAnnotationsListener.php
@@ -251,9 +251,8 @@ public function handleInputAnnotation($e)
return;
}
- $name = $e->getParam('name');
- $filterSpec = $e->getParam('filterSpec');
- $filterSpec[$name] = $annotation->getInput();
+ $inputSpec = $e->getParam('inputSpec');
+ $inputSpec['type'] = $annotation->getInput();
}
/**
View
18 tests/ZendTest/Form/Annotation/AnnotationBuilderTest.php
@@ -5,7 +5,6 @@
* @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\Annotation;
@@ -243,4 +242,21 @@ public function testObjectElementAnnotation()
$this->assertInstanceOf("Zend\Stdlib\Hydrator\ClassMethods",$fieldset->getHydrator());
$this->assertFalse($fieldset->getHydrator()->getUnderscoreSeparatedKeys());
}
+
+ public function testInputFilterInputAnnotation()
+ {
+ $entity = new TestAsset\Annotation\EntityWithInputFilterInput();
+ $builder = new Annotation\AnnotationBuilder();
+ $form = $builder->createForm($entity);
+ $inputFilter = $form->getInputFilter();
+
+ $this->assertTrue($inputFilter->has('input'));
+ foreach (
+ array('Zend\InputFilter\InputInterface', 'ZendTest\Form\TestAsset\Annotation\InputFilterInput') as
+ $expectedInstance
+ ) {
+ $this->assertInstanceOf($expectedInstance, $inputFilter->get('input'));
+ }
+
+ }
}
View
1 tests/ZendTest/Form/TestAsset/Annotation/ClassEntity.php
@@ -5,7 +5,6 @@
* @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;
View
1 tests/ZendTest/Form/TestAsset/Annotation/ComplexEntity.php
@@ -5,7 +5,6 @@
* @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;
View
1 tests/ZendTest/Form/TestAsset/Annotation/Element.php
@@ -5,7 +5,6 @@
* @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;
View
1 tests/ZendTest/Form/TestAsset/Annotation/Entity.php
@@ -5,7 +5,6 @@
* @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;
View
1 tests/ZendTest/Form/TestAsset/Annotation/EntityComposingAnEntity.php
@@ -5,7 +5,6 @@
* @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;
View
1 tests/ZendTest/Form/TestAsset/Annotation/EntityUsingObjectProperty.php
@@ -5,7 +5,6 @@
* @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;
View
1 tests/ZendTest/Form/TestAsset/Annotation/EntityUsingOptions.php
@@ -5,7 +5,6 @@
* @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;
View
1 tests/ZendTest/Form/TestAsset/Annotation/EntityWithHydratorArray.php
@@ -5,7 +5,6 @@
* @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;
View
21 tests/ZendTest/Form/TestAsset/Annotation/EntityWithInputFilterInput.php
@@ -0,0 +1,21 @@
+<?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
+ */
+
+namespace ZendTest\Form\TestAsset\Annotation;
+
+use Zend\Form\Annotation;
+
+class EntityWithInputFilterInput
+{
+
+ /**
+ * @Annotation\Input("ZendTest\Form\TestAsset\Annotation\InputFilterInput")
+ */
+ public $input;
+}
View
1 tests/ZendTest/Form/TestAsset/Annotation/EntityWithTypeAsElementName.php
@@ -5,7 +5,6 @@
* @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;
View
1 tests/ZendTest/Form/TestAsset/Annotation/ExtendedEntity.php
@@ -5,7 +5,6 @@
* @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;
View
1 tests/ZendTest/Form/TestAsset/Annotation/Form.php
@@ -5,7 +5,6 @@
* @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;
View
1 tests/ZendTest/Form/TestAsset/Annotation/InputFilter.php
@@ -5,7 +5,6 @@
* @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;
View
16 tests/ZendTest/Form/TestAsset/Annotation/InputFilterInput.php
@@ -0,0 +1,16 @@
+<?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
+ */
+
+namespace ZendTest\Form\TestAsset\Annotation;
+
+use Zend\InputFilter\Input as Ancestor;
+
+class InputFilterInput extends Ancestor
+{
+}
View
1 tests/ZendTest/Form/TestAsset/Annotation/SampleEntity.php
@@ -5,7 +5,6 @@
* @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;
View
1 tests/ZendTest/Form/TestAsset/Annotation/TypedEntity.php
@@ -5,7 +5,6 @@
* @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;
View
1 tests/ZendTest/Form/TestAsset/Annotation/UrlValidator.php
@@ -5,7 +5,6 @@
* @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;
View
1 tests/ZendTest/Form/TestAsset/Model.php
@@ -5,7 +5,6 @@
* @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;