DoctrineExtensions-Taggable icon indicating copy to clipboard operation
DoctrineExtensions-Taggable copied to clipboard

Incomplete readme files

Open sensorario opened this issue 12 years ago • 6 comments

Sorry but in your readme.md file you say "Finally, you need to setup doctrine for register metadata directory and register TagListener." Ok. But where I have to put this code? How can I configure doctrine for this stuff?

Thank you in advance.

sensorario avatar Mar 05 '12 10:03 sensorario

I'm struggling with this too. Installed via FPNTagBundle as per the documentation and I can create tags and add them to entities OK but can't get the repository to work :(

in an action:

$em = $this->getDoctrine()->getEntityManager();
$tagRepo = $em->getRepository('DoctrineExtensions\\Taggable\\Entity\\Tag');
$ids = $tagRepo->getResourceIdsForTag('organisation', $tag);

I get

Class DoctrineExtensions\Taggable\Entity\Tag is not a valid entity or mapped super class.

It's bound to be something simple, but I don't know enough about the Doctrine configuration to fix this. Can you help, please @FabienPennequin?

tonypiper avatar Apr 25 '12 09:04 tonypiper

I am also struggling with this. Does anyone have a good step by step procedure for a newbie?

dantuck avatar Jun 05 '12 18:06 dantuck

You can try to add the annotation to your Tag Entity

@ORM\Entity(repositoryClass="DoctrineExtensions\Taggable\Entity\TagRepository")

and using the repo

$em = $this->getDoctrine()->getEntityManager();
$tagRepo = $em->getRepository('YourBundle:Tag');
$ids = $tagRepo->getResourceIdsForTag('organisation', $tag);

This have work for me (symfony 2.1.5)

estheban avatar Dec 10 '12 18:12 estheban

You can also extend the included TagRepository if you need to have a repository of your own.

<?php

namespace App\Bundle\TagBundle\Entity;

use Doctrine\ORM\NoResultException;
use DoctrineExtensions\Taggable\Entity\TagRepository as BaseRepository;

class TagRepository extends BaseRepository {

    //...

Now you can do

$em = $this->getDoctrine()->getEntityManager();
$tagRepo = $em->getRepository('YourBundle:Tag');
$ids = $tagRepo->getResourceIdsForTag('organisation', $tag);

like @estheban has above.

ornj avatar Apr 03 '13 21:04 ornj

Hi !

Same here, I began to integrate this bundle to my project but I'm stock at the :

"Finally, you need to setup doctrine for register metadata directory and register TagListener."

I just need the file where to put this code. I search on google and found this post on google :

https://groups.google.com/forum/#!topic/symfony2/tqxGRLiEDTs

But I can see the link, it seems to have work for this guy.

Thank's,

Anthony

taoder avatar Nov 17 '13 14:11 taoder

This is the shittiest readme file ever written. Actually pissed me off, it's like it was written to be purposefully confusing

ghost avatar Dec 02 '17 17:12 ghost