Why do I get a "validator did not work" and save with Doctrine on Symfony 1.2?

Let's say that my YAML scheme looks like this:

Note:
  options:
    type: MyISAM
    collate: utf8_unicode_ci
    charset: utf8
  actAs: { Timestampable: ~ }
  columns:
    content: { type: string, notnull: true}
    order_id: int(5)
    user_id : int
  relations:
    User:
      foreignAlias: Notes
      local: user_id
      foreign: id
      type: one
      foreignType: man
      onDelete: CASCADE

By doing:

$note->setOrderId(0);
$note->save();

I get the following error:

1 validator failed on order_id (type)

MySQL stores order_id as bigint (20).

I am using Ubuntu 9.10, Symfony 1.2, PHP 5 and MySQL 5.

EDIT:

Got a hint, if I remove all mention of size in the YAML file, I get a second validation error for order_id (length) :-)

+3
source share
2 answers

I understood. Replacing "int" with "integer" and getting rid of size did the trick. Now the YAML file looks like this:

Note:
  options:
    type: MyISAM
    collate: utf8_unicode_ci
    charset: utf8
  actAs: { Timestampable: ~ }
  columns:
    content: { type: string, notnull: true}
    order_id: integer
    user_id : integer
  relations:
    User:
      foreignAlias: Notes
      local: user_id
      foreign: id
      type: one
      foreignType: man
      onDelete: CASCADE

, , "varchar" "string".

- , : -)

+2

, ...

, , - "", "", "", "", "", "clob", "blob", "enum", "array".

Doctrine .

"int" , "integer".

0

Source: https://habr.com/ru/post/1709394/


All Articles