【发布时间】:2013-07-07 21:49:00
【问题描述】:
这只是没有意义。我似乎无法进行简单的 Symfony2 验证。
$insert = new MyEntity();
$insert->setTest1( 'test' );
$validator = $this->get('validator');
$errors = $validator->validate($insert);
...但是 $errors 始终是具有空约束数组的对象。它永远不会通过验证。
我的配置(Yaml):
MyBundle\Entity\MyEntity:
properties:
test1:
- MinLength: 10
- Email
type: entity
table: null
fields:
id:
type: integer
id: true
generator:
strategy: AUTO
test1:
type: string
length: 255
column: test_1
test2:
type: integer
column: test_2
lifecycleCallbacks: { }
【问题讨论】:
标签: symfony doctrine-orm doctrine