Model-layer validation in Doctrine, Symfony

Posted by Andree on Stack Overflow See other posts from Stack Overflow or by Andree
Published on 2010-03-19T09:57:21Z Indexed on 2010/03/19 10:01 UTC
Read the original article Hit count: 267

Filed under:
|

Hi there,

I have a schema.yml containing something similiar to the following:

Character:
  tableName: characters 
  actAs: { Timestampable: ~ }
  columns:
    id: { type: integer(4), primary: true, autoincrement: true }
    name: { type: string(255), notnull: true, notblank: true, minlength: 3 }

I define the minlength of the column name to be 3. I created a unit test to test the minlength validation, and I found out that the validation is not working.

$character = new Character();
$character->set('name', 'Dw');
$t->ok(! $character->isValid()); # This test failed

Can someone tell me what might be the problem here?

Thanks, Andree

© Stack Overflow or respective owner

Related posts about doctrine

Related posts about symfony