-
Notifications
You must be signed in to change notification settings - Fork 87
set correct Factory when autoAddInvokableClass=true #134
set correct Factory when autoAddInvokableClass=true #134
Conversation
Can you explain what problem this fixes? |
When you get element with options :
this is wrong |
@@ -0,0 +1,25 @@ | |||
<?php | |||
/** | |||
* Zend Framework (http://framework.zend.com/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the license header and use:
/**
* @see https://github.com/zendframework/zend-navigation for the canonical source repository
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-form/blob/master/LICENSE.md New BSD License
*/
|
||
if (! $this->has($name)) { | ||
if (! $this->autoAddInvokableClass || ! class_exists($name)) { | ||
throw new Exception\ServiceNotFoundException(sprintf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ServiceNotFoundException
is not imported.
test/FormElementManagerTest.php
Outdated
@@ -222,6 +222,13 @@ public function testAddingInvokableCreatesAliasAndMapsClassToElementFactory() | |||
} | |||
} | |||
|
|||
public function testAutoAddInvokableClass() | |||
{ | |||
$instance = $this->manager->get(TestAsset\ConstructedElement::class, ['constructedKey' => 'constructedKey']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reduce the line length to 80.
|
||
class ConstructedElement extends Element | ||
{ | ||
public $constructedKey = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove null
.
{ | ||
public $constructedKey = null; | ||
|
||
public function __construct($name = null, $options = array()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a type hint for $options
.
@froschdesign Your requested changes have been applied |
Author has made the requested changes.
Forward port #134 Conflicts: CHANGELOG.md
Thanks, @turrsis |
set correct
Zend\Form\ElementFactory
(instead ofZend\ServiceManager\Factory\InvokableFactory
) whenFormElementManager::autoAddInvokableClass = true
.fix for #114