Hi,

I just realized that there is no way to get rid of validation rules defined in 
a parent class when extending. Now I can think of a couple of approaches to 
handle this:

1) all annotations are inherited by default. redefining a property in a child 
class, clears all parent annotations for that property

2) same as 1) but there is additionally a @validation:Inherit to import all 
parent validation rules

3) all annotations are inherited by default. using @validation:clearParent 
clears all parent validation rules.

I was also thinking about some annotation to allow "overwriting" of parent 
validation rules like, but that probably makes no sense unless validation rules 
start getting names:

class User extends BaseUser
{
    /**
     * @validation:Validation({
     *      @validation:Overload("min","max"),
     *      @validation:MinLength(name="min", limit=1, message="The firstname 
is too short", groups="Registration"),
     *      @validation:MaxLength(name="max", limit=255, message="The firstname 
is too long", groups="Registration")
     * })
     * @var string
     */
    protected $firstname;
}

class BaseUser
{
    /**
     * @validation:Validation({
     *      @validation:NotBlank(name="blank", message="Please enter a 
firstname", groups="Registration"),
     *      @validation:MinLength(name="min", limit=2, message="The firstname 
is too short", groups="Registration"),
     *      @validation:MaxLength(name="max", limit=100, message="The firstname 
is too long", groups="Registration")
     * })
     * @var string
     */
    protected $firstname;
}

regards,
Lukas Kahwe Smith
m...@pooteeweet.org



-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to