Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

FormElementManager compatibility break at 2.7 #62

Closed
@chris-moreton

Description

@chris-moreton

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:

$fem = $this->getServiceLocator()->get('FormElementManager');
$form = $fem->get('Application\Form\Lpa\ApplicantForm', ['lpa'=>$this->getLpa()]);

Which creates a form with the constructor:

    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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions