2007-09-02 18:24:49 +04:00
|
|
|
<?php
|
2008-05-14 01:20:34 +04:00
|
|
|
class ValidatorTest extends Doctrine_Entity {
|
2008-02-04 00:29:57 +03:00
|
|
|
public static function initMetadata($class) {
|
|
|
|
$class->setColumn('mymixed', 'string', 100);
|
2008-02-24 01:04:39 +03:00
|
|
|
$class->setColumn('mystring', 'string', 100,
|
|
|
|
array('validators' => array('notnull', 'unique'))
|
|
|
|
);
|
2008-02-04 00:29:57 +03:00
|
|
|
$class->setColumn('myarray', 'array', 1000);
|
|
|
|
$class->setColumn('myobject', 'object', 1000);
|
|
|
|
$class->setColumn('myinteger', 'integer', 11);
|
2008-02-24 01:04:39 +03:00
|
|
|
$class->setColumn('myrange', 'integer', 11,
|
|
|
|
array('validators' => array('range' => array(4,123)))
|
|
|
|
);
|
|
|
|
$class->setColumn('myregexp', 'string', 5,
|
|
|
|
array('validators' => array('regexp' => '/^[0-9]+$/'))
|
|
|
|
);
|
|
|
|
$class->setColumn('myemail', 'string', 100,
|
|
|
|
array('validators' => array('email'))
|
|
|
|
);
|
|
|
|
$class->setColumn('myemail2', 'string', 100,
|
|
|
|
array('validators' => array('email', 'notblank'))
|
|
|
|
);
|
2007-09-02 18:24:49 +04:00
|
|
|
}
|
|
|
|
}
|