#1652: New constant 'Doctrine::VALIDATE_USER'
-----------------------------------+--------------------------------------- -
Reporter: floriank | Owner: jwage
Type: enhancement | Status: new
Priority: minor | Milestone: 1.1.0
Component: Attributes | Version: 1.1-DEV
Keywords: validation | Has_test: 1
Mystatus: Pending Core Response | Has_patch: 1
-----------------------------------+--------------------------------------- -
I'm missing a constant to control validation process in Doctrine to only
check self-written Record->validate() methods without validating datatypes
/ lengths / constraints (see testcase).
A possible solution would be to add a constant Doctrine::VALIDATE_USER
(see patch). This patch breaks none of the testcases in Doctrine 1.1's
testsuite.
You can already disable length/type validations. I dont remember the
constant names right now. SOmething like
ATTR_VALIDATE_LENGTH/ATTR_VALIDATE_TYPE. Is that not sufficient?
Replying to [comment:1 romanb]:
> I dont remember the constant names right now.
It is
{{{
Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_VALIDATE,
Doctrine::VALIDATE_ALL &
~Doctrine::VALIDATE_LENGTHS &
~Doctrine::VALIDATE_CONSTRAINTS &
~Doctrine::VALIDATE_TYPES);
}}}
I want to disable all validation except the validate()-method of the
Records, which is not possible because the code above is the same as
Replying to [comment:3 jwage]:
> I don't understand your patch. It adds the constant but does not use it
anywhere?
Take a look at my testcase: It's used in there ([http://trac.doctrine- project.org/attachment/ticket/1652/1652TestCase.php#L53]). The constant is
not used anywhere else in Doctrine since it is an ''additional'' option
for validation to only run user-defined validate()-methods without beeing
forced to use type/length/constraint-validations.