[Doctrine] #1524: Possibility to add validators

2 views
Skip to first unread message

Doctrine

unread,
Oct 2, 2008, 1:36:28 PM10/2/08
to doctri...@googlegroups.com
#1524: Possibility to add validators
-----------------------------------+----------------------------------------
Reporter: hwestphal | Owner: jwage
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: Validators | Version: 1.0.2
Keywords: | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 1
-----------------------------------+----------------------------------------
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.

--
Ticket URL: <http://trac.doctrine-project.org/ticket/1524>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper

Doctrine

unread,
Oct 2, 2008, 6:25:10 PM10/2/08
to doctri...@googlegroups.com
#1524: Possibility to add validators
--------------------------+-------------------------------------------------
Reporter: hwestphal | Owner: jwage
Type: enhancement | Status: new
Priority: minor | Milestone: 1.1.0
Component: Validators | Version:
Resolution: | Keywords:
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 1 |
--------------------------+-------------------------------------------------
Changes (by jwage):

* version: 1.0.2 =>
* milestone: => 1.1.0

--
Ticket URL: <http://trac.doctrine-project.org/ticket/1524#comment:1>

Doctrine

unread,
Dec 1, 2008, 5:31:32 PM12/1/08
to doctri...@googlegroups.com
#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:

--

Comment:

In r5231 this was fixed.

--
Ticket URL: <http://trac.doctrine-project.org/ticket/1524#comment:2>

Reply all
Reply to author
Forward
0 new messages