Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to solve issue ZF2-558 #2393

Closed
wants to merge 7 commits into from

Conversation

@igormx
Copy link
Contributor

igormx commented Sep 20, 2012

The setValueOptions method of Zend/Form/Element/Select and Zend/Form/Element/Select were updating the options of the Element but were not updating the InArray Validator Haystack if the options were added after that the validator were attached.

@ghost ghost assigned weierophinney Sep 21, 2012
@cgmartin

This comment has been minimized.

Copy link
Contributor

cgmartin commented Sep 21, 2012

Needs CS style fixes with the indentation (4 spaces). Looks good otherwise IMO.

@igormx

This comment has been minimized.

Copy link
Contributor Author

igormx commented Sep 21, 2012

Done, i have fix the indentation. TY

weierophinney added a commit that referenced this pull request Sep 21, 2012
- indentation
- trailing spaces
weierophinney added a commit that referenced this pull request Sep 21, 2012
Forward port #2393
@timdev

This comment has been minimized.

Copy link

timdev commented on 294a7d1 Sep 27, 2012

I think this is a bad solution (or I'm missing something). There's no guarantee that if $this->validator is not an instance of InArray that whatever it is implements a getValidator() method. It's not clear to me what $this->validator is expected to be if the instanceof test fails (which is why I'm not providing an alternative solution).

For instance, this change appears to break DoctrineORMModule\Form\Element\DoctrineEntity, which overrides Select::getValidator().

This comment has been minimized.

Copy link

timdev replied Sep 27, 2012

Aha! This patch assumes that $this->validator is either an instanceof InArray or Explode. I've fixed my problem for now by simply subclassing DoctrineEntity and overriding setValueOptions() to behave like it did before this commit. I suppose I could put a pull request in for DoctrineORMModule to do the same there, which would fix the issue. But perhaps there's a more elegant solution at this level.

This comment has been minimized.

Copy link

timdev replied Sep 27, 2012

I've made a pull request that I think resolves the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.