I use console command to generate new entity:

$ php app/console doctrine:generate:entity

How can I set the options scale and precision for field of type decimal (and other options for other field types) by using this console command?

有帮助吗?

解决方案

You can't set precision and scale via console. You have to mention these attributes when you declare fields, either in ORM YAML file, as annotation, etc.

To see how to set precision and scale in annotation, here is the link,

http://docs.doctrine-project.org/en/2.0.x/reference/annotations-reference.html#column

You can see all available doctrine 2 data types in here,

http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html

For Decimal precision and scale you can see it in here,

http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html#id89

Hope this helps, Cheers!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top