Symfony changes too much and the documentation does not keep up

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com, or follow me on Twitter.

Damn, I lost hours to this stupid bit of syntax, due to some minor change in the way Doctrine processes the schema.yml file.

Back a year ago, in Symfony 1.2, you could get the model classes to automatically fill in a field called “created_at”. You did not need to do a thing. Symfony/Propel understod that if this field existed in a database table, then it should be filled with the datatime that a record was created at.

Now I’m working with Symfony 1.4 and Doctrine. The created_at field is less magic now, and there seems to be multiple ways of specifying the activity that you want. It’s confusing. One sees pages like this where confused programmers are running into trouble:

In ‘plugins/sfDoctrineGuardPlugin/config/doctrine/schema.yml’:

sfGuardUser:
actAs: [Timestampable]
columns:
id:
type: integer(4)
primary: true
autoincrement: true
username:
type: string(128)
notnull: true
unique: true

There are also examples like this:

SearchesForExportToBeRunByCronScript:
actAs: { taggable: ~ , timestampable: ~ ]
connection: doctrine
tableName: searches_for_export_to_be_run_by_cron_script
columns:
id:
type: integer(20)
fixed: false
unsigned: false
primary: true
autoincrement: true
ids_for_search:
type: string()
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false

What actually worked for me was:

SearchesForExportToBeRunByCronScript:
templates: [ Doctrine_Template_Timestampable ]
connection: doctrine
tableName: searches_for_export_to_be_run_by_cron_script
columns:
id:
type: integer(20)
fixed: false
unsigned: false
primary: true
autoincrement: true
ids_for_search:
type: string()
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false

We use these big frameworks, like Symfony and Ruby On Rails, because they are suppose to help our productivity. But if they change too much, too fast, or if they are poorly documented, then they do not increase our productivity. Rather, we spend hours trying to figure out what is broken.

Post external references

  1. 1
    http://stackoverflow.com/questions/2618004/is-possible-overwriting-a-doctrine-model-in-symfony
  2. 2
    http://trac.doctrine-project.org/ticket/523
Source