You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
public function __construct($name, $options)
{
if(array_key_exists('lpa', $options)) {
$this->lpa = $options['lpa'];
unset($options['lpa']);
}
parent::__construct($name, $options);
}
When I upgrade to version 2.7.0 or higher of Zend Form, this causes my application to fail. It turns out that the $options argument is being passed in as the $name argument, and there is no second argument to the form constructor.
Prior to 2.7.0, $name would come in as "Application\Form\Lpa\ApplicantForm", as expected, and $options would come in as the array that was passed to FormElementManager::get.
I have been digging through the code trying to identify where this behaviour changed, so far without success. I will keep looking.
The text was updated successfully, but these errors were encountered:
The problem here turns out to be the removal of the createFromInvokable function from FormElementManager which was being called from doCreate in ServiceManager. The removal of this function results in the createFromInvokable function from AbstractPluginManager being called, which creates the object with
$instance = new $invokable($this->creationOptions);
as opposed to
$instance = new $invokable($name, $options);
which was the code from the FormElementManager version of createFromInvokable.
Internally, we've updated all shipped elements such that instead of mapping as invokables, they map to a new Zend\Form\ElementFactory, which performs the logic that was originally in createFromInvokable().
My guess is you're mapping your instances as invokables, and pointing them to Element::class. Can you confirm?
The behaviour of FormElementManager::get has changed as of version 2.7.0.
I have a project that creates a form with code such as the following:
Which creates a form with the constructor:
When I upgrade to version 2.7.0 or higher of Zend Form, this causes my application to fail. It turns out that the $options argument is being passed in as the $name argument, and there is no second argument to the form constructor.
Prior to 2.7.0, $name would come in as "Application\Form\Lpa\ApplicantForm", as expected, and $options would come in as the array that was passed to FormElementManager::get.
I have been digging through the code trying to identify where this behaviour changed, so far without success. I will keep looking.
The text was updated successfully, but these errors were encountered: