Hey, yes it's possible to change the default type of your primary keys with a simple configuration
Open your config/databases.yml
. It should looks like this :
[yml] # You can find more information about this file on the symfony website: # http://www.symfony-project.org/reference/1_4/en/07-Databases all: doctrine: class: sfDoctrineDatabase param: dsn: mysql:host=localhost;dbname=. username: root password:
But Doctrine lets you customize some things. Now the file looks like :
[yml] # You can find more information about this file on the symfony website: # http://www.symfony-project.org/reference/1_4/en/07-Databases all: doctrine: class: sfDoctrineDatabase param: dsn: mysql:host=localhost;dbname=. username: root password: attributes: default_identifier_options: type: integer length: 4 unsigned: true
Nowyou can change the parameter, lets say an integer, and length: 5.
It's event possible to add any configuration that will be added automatically to your model.
Note: It's not possible to set autoincrement: false
. True is forced by doctrine.
Note: This behavior is true when no primary column is found in your schema.
Thanks to PhilG (#symfony-fr @ Freenode) for testing. Tested with symfony 1.4.1