I want to attribute some tags to some of the objects of my doctrine model.
I found sfDoctrineActAsTaggablePlugin which seems to be precisely what I need.
The pro
Edit: Have you done a build all reload?
You need to add templates: [Taggable] to your schema not actAs.
Mishidea:
connection: doctrine
actAs: [Timestampable]
templates: [Taggable]
tableName: mishidea
columns:
idea_id:
type: integer(4)
primary: true
autoincrement: true
Possible Issues:
Make sure you have the plugin enabled
In ProjectConfiguration::setup
, you should have
$this->enablePlugins(array(
'sfDoctrineActAsCommentablePlugin', //plus other plugins, like Doctrine
));
Set Up Your Schema Correctly
It should look like this:
ModelClass:
actAs:
Taggable:
columns: //etc
You should be using actAs
not templates
.
I don't believe you need to set an explicit relations for Tags, but I could be wrong about that. If you let me know, I will edit this answer.
Whoop whoop!! I solved this problem, at last!
Well... The problem is that the sfDoctrineActAsTaggablePlugin plugin does work only for taggable objects which have an id property called precisely "id". I like to put the name of the entity in the name of my properties, that's why I called the idea of my taggable entity "idea_id".
As soon as I replaced "idea_id" by "id" everything worked like a charm (you may have several changes to do in the schema.yml and maybe even in the routing.yml file later on).
I don't know if I'm clear enough so don't hesitate to ask me further explanations.
Anyway that's a bit of a shame for this plugin, it is not generic enough (will report this to the developers).
BTW, all the syntaxes for actAs written in my first post are equivalent, use whichever you prefer.
Thank you all for your help, each reply was an encouragement without which I wouldn't have had the strength to find the bug ;).
Cheers