#1524: Possibility to add validators
--------------------------+-------------------------------------------------
Reporter: hwestphal | Owner: jwage
Type: enhancement | Status: closed
Priority: minor | Milestone: 1.1.0
Component: Validators | Version:
Resolution: fixed | Keywords:
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 1 |
--------------------------+-------------------------------------------------
Changes (by jwage):
* status: new => closed
* resolution: => fixed
Old description:
> When creating models from a schema.yml file you have the option to add
> several validators:
>
> {{{
> Contact:
> tableName: contact
> columns:
> name:
> type: string(255)
> notblank: true
> email:
> type: string(255)
> email: true
> attributes:
> validate: true
> }}}
>
> But if you want to add a custom validator doctrine will not know it and
> an exception is thrown like:
>
> ''Invalid schema element named "customvalidator" at path
> "Contact->columns->customfield"''
>
> I attached a patch which will add a static function to the Doctrine_Lib
> class called "registerValidators" to solve this problem.
>
> With this patch we can call
> Doctrine_Lib::registerValidators('customvalidator') or
> Doctrine_Lib::registerValidators(array('customvalidator',
> 'customvalidator2')).
> Afterwards the build task will complete without throwing an exception.
New description:
When creating models from a schema.yml file you have the option to add
several validators:
{{{
Contact:
tableName: contact
columns:
name:
type: string(255)
notblank: true
email:
type: string(255)
email: true
attributes:
validate: true
}}}
But if you want to add a custom validator doctrine will not know it and an
exception is thrown like:
''Invalid schema element named "customvalidator" at path
"Contact->columns->customfield"''
I attached a patch which will add a static function to the Doctrine_Lib
class called "registerValidators" to solve this problem.
With this patch we can call
Doctrine_Lib::registerValidators('customvalidator') or
Doctrine_Lib::registerValidators(array('customvalidator',
'customvalidator2')).
Afterwards the build task will complete without throwing an exception.
--
Comment:
In r5231 this was fixed.
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1524#comment:2>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---