Hi everyone,

I'm a little new to ZF2 so please forgive me if the question is
mind-numbingly obvious.

I have an entity called 'User', which has a number of fields and and input
filters, created through a 'getInputFilter' function.

I'm trying to work out in my head what the best solution for my application
would be. I would like to use some of the elements (e.g. email and password)
in a login form, but then all of them in a 'edit account' form. The benefit
to me doing it that way is that all of my validators and filters are in one
place, in the entity.

What I've done previously is put a 'type' condition on the getInputFilter
function, so only some elements will be added to the input filter, depending
on what 'type' is from the controller. That way, if 'type' is 'login', then
only 'email' and 'password' will be added to the input validator. That means
when I include two elements with the same name on a form, then the form will
validate and filter correctly when running setInputFilter against the form. 

I'm convinced this isn't the right way. Could someone help me in the best
way to approach this?

Thanks,
Oli



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Conditional-validators-for-entity-input-filters-tp4658172.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to