This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
Inject input filter factory when creating new input filter #24
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Need tests |
ffraenz
changed the title
Inject input filter factory
Inject input filter factory when creating new input filter
Nov 26, 2015
I test if |
Factory should be set too after the inputfilter created on line 681 |
That should do. |
Do you consider merging? Is there anything else you need? |
weierophinney
added a commit
that referenced
this pull request
Apr 7, 2016
Inject input filter factory when creating new input filter
weierophinney
added a commit
that referenced
this pull request
Apr 7, 2016
weierophinney
added a commit
that referenced
this pull request
Apr 7, 2016
Sorry for the delay reviewing and merging, @ffraenz - merged now, and will be released in a 2.7.1 version soon. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Custom validators and filters are not available in forms pulled from the
FormElementManager
. I already discussed this issue here.When the object bound to the form does not implement
InputFilterAwareInterface
, the form creates itsInputFilter
instance itself whengetInputFilter
gets called:In this case, the
Zend\InputFilter\Factory
dependency of this newly created input filter instance does not get satisfied which results in creating a different factory instance with separateServiceManagers
lazily.The form has a pointer to a
Zend\InputFilter\Factory
instance with properly injectedServiceManagers
. Adding following line right after the statement shown above makes custom filters and validators available inside the form as expected:Both
getFormFactory
andgetInputFilterFactory
create instances lazily if they have not been injected. This statement should never fail.