FabienPennequin / FPNTagBundle

This bundle allows to tag your Doctrine entities easily
http://knpbundles.com/FabienPennequin/FPNTagBundle
76 stars 50 forks source link

Get Tags related to an Article Id #19

Closed melkir closed 2 years ago

melkir commented 11 years ago

Hi, How can I get the tag list related to an article id ?

I've try to use in my indexAction controller $listPost = $tagManager->loadTagging($post); and render to my view the listPost but the listPost is null :(

Same for $listPost = $post->getTags();

Finally i need an getResourceTagsForId methods like getResourceIdsForTag provided in the manual instruction (the reverse order).

melkir commented 11 years ago

Ok problem solved; i have add to my controller $tagManager = $this->get('fpn_tag.tag_manager'); $tags = $tagManager->loadTagging($article); And I my view {% for tag in article.tags %} {{ tag }} {% endfor %}

Now I need a form with a field for tags ! but when i submit the form I have setTags() Maybe you should create the method "setTags()"?

I know how to add value with the tag manager but not with set method :( !

tfernandez commented 10 years ago

To handle forms you need a DataTransformer and a widget. More info at https://github.com/FabienPennequin/FPNTagBundle/issues/7