I’m new to Symfony, and I don’t even succeed in creating valid models.
I created my project – which use propel – and wrote the following schema.yml:
propel:
poc:
id: ~
message: { type: varchar(140), required: true}
author: { type: varchar(255), required: true}
plus: { type: integer, default: 0}
minus: { type: integer, default: 0}
created_at: ~
Then I executed the following commands without errors:
$ php symfony propel:build --sql
$ php symfony propel:insert-sql
$ php symfony propel:build --model
But when I try to load fixtures or generate a module, I obtain this error:
$ php symfony propel:data-load
>> propel load data from "/home/me/www/poc/data/fixtures"
PHP Fatal error: Cannot redefine class constant BasePoc::PEER in /home/me/www/poc/lib/model/om/BasePoc.php on line 85
Fatal error: Cannot redefine class constant BasePoc::PEER in /home/me/www/poc/lib/model/om/BasePoc.php on line 85
The class constant PEER is defined twice in the BasePoc.php, but why ?
I googled and recreated the project several times, but I couldn’t see my mistake.
If you are using the new sfPropelORMPlugin instead of the sfPropelPlugin bundled with symfony, just read the README file on the plugin, you are missing the last step:
Note: a quick “bulk replace” on the file is enough.
Note 2: if you are using sfPropel15Plugin, please upgrade to sfPropelORMPlugin.
hope it helps!