From 06f92f65df7ced84c6f458038fbd2009d451f8e5 Mon Sep 17 00:00:00 2001 From: Paolo Agostinetto Date: Mon, 22 Jul 2019 16:42:13 +0200 Subject: [PATCH 1/2] Fixed config for TwbBundleFormElement and Navigation helper --- config/module.config.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/config/module.config.php b/config/module.config.php index 203802e..9415817 100644 --- a/config/module.config.php +++ b/config/module.config.php @@ -21,6 +21,15 @@ ), ), 'view_helpers' => array ( + 'aliases' => array ( + 'form_element' => 'TwbBundle\Form\View\Helper\TwbBundleFormElement', + 'formElement' => 'TwbBundle\Form\View\Helper\TwbBundleFormElement', + 'formelement' => 'TwbBundle\Form\View\Helper\TwbBundleFormElement', + + 'navigation' => 'TwbBundle\View\Helper\Navigation', + 'Navigation' => 'TwbBundle\View\Helper\Navigation', + 'zendviewhelpernavigation' => 'TwbBundle\View\Helper\Navigation', + ), 'invokables' => array ( //Alert 'alert' => 'TwbBundle\View\Helper\TwbBundleAlert', @@ -98,18 +107,8 @@ 'formhidden' => 'Zend\Form\View\Helper\FormHidden', ), 'factories' => array ( - 'formElement' => 'TwbBundle\Form\View\Helper\Factory\TwbBundleFormElementFactory', - 'form_element' => 'TwbBundle\Form\View\Helper\Factory\TwbBundleFormElementFactory', - 'formelement' => 'TwbBundle\Form\View\Helper\Factory\TwbBundleFormElementFactory', 'TwbBundle\Form\View\Helper\TwbBundleFormElement' => 'TwbBundle\Form\View\Helper\Factory\TwbBundleFormElementFactory', - - 'navigation' => 'TwbBundle\Navigation\View\NavigationHelperFactory', - 'zendviewhelpernavigation' => 'TwbBundle\Navigation\View\NavigationHelperFactory', - ), - 'aliases' => array ( - 'form_element' => 'TwbBundle\Form\View\Helper\TwbBundleFormElement', - - 'Navigation' => 'TwbBundle\Navigation\View\NavigationHelperFactory', + 'TwbBundle\View\Helper\Navigation' => 'TwbBundle\Navigation\View\NavigationHelperFactory', ), ), ); From 4d58041e3c6a12f3352f7b23a35db91606789a34 Mon Sep 17 00:00:00 2001 From: Paolo Agostinetto Date: Mon, 22 Jul 2019 17:16:21 +0200 Subject: [PATCH 2/2] Fix "formElement" container config. From what I understand, aliases are processed before factories, so when merging the configuration of all ZF modules, the 'aliases/formElement' entry in zend-form takes precedence and the factory entry 'factories/formElement' is ignored. In order to override the zend-form's element, we need to create an alias with that name. --- tests/TwbBundleTest/ConfigProviderTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/TwbBundleTest/ConfigProviderTest.php b/tests/TwbBundleTest/ConfigProviderTest.php index fa27231..00aef6e 100644 --- a/tests/TwbBundleTest/ConfigProviderTest.php +++ b/tests/TwbBundleTest/ConfigProviderTest.php @@ -40,4 +40,12 @@ public function testInvokeReturnValues() $this->assertNotEmpty($config['dependencies']); $this->assertNotEmpty($config['view_helpers']); } + + public function testFormElementRegression() + { + $config = $this->configProvider->__invoke(); + $this->assertArrayHasKey('formElement', $config['view_helpers']['aliases']); + } + + }