fabienpennequin / fpntagbundle Goto Github PK
View Code? Open in Web Editor NEWThis bundle allows to tag your Doctrine entities easily
Home Page: http://knpbundles.com/FabienPennequin/FPNTagBundle
This bundle allows to tag your Doctrine entities easily
Home Page: http://knpbundles.com/FabienPennequin/FPNTagBundle
Suppose that I have to search tagged types by 2 or 3 tags... How should I do?
And... the column resource_id should be integer don't?
When inserting a tag with accents (é à ...) they are kept in slug and can lead to errors in URL.
In my app I have two kinds of taggables: Products and Templates. Tags for each taggable have a different purpose so the two kinds don't even overlap. I don't understand the design decision to only have the resource_type on the Taggable side since "orphan" tags don't have a Tagable yet. I run into a few problems when I tried to add my own field to the Tag entity in Symfony. Is that suppose to be possible with no problems?
Hi, I see this great bundle has been virtually unchanged the last year.
Would you please create a version for it so that I do not have to check for dev-master every time I do an install?
kind regards,
Tarjei
Thank you for the great bundle! I followed the instructions for installation using annotations and everything worked perfectly until I tried to change the table names for the tag and tagging entities.
After the database was updated for the new table names I attempted to load fixtures and an exception was thrown with a message indicating the "Tag" table did not exist.
To make a long story short, I was able to resolve this problem by adding a leading "" to the model: definitions in config.yml
fpn_tag:
model:
tag_class: \Acme\TagBundle\Entity\Tag
tagging_class: \Acme\TagBundle\Entity\Tagging
Alternatively, l think that the leading "" could be added in FPNTagBundle/Reources/config/orm.xml
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="fpn_tag.tag_manager.class">FPN\TagBundle\Entity\TagManager</parameter>
<parameter key="fpn_tag.entity.tag.class">FPN\TagBundle\Entity\Tag</parameter>
<parameter key="fpn_tag.entity.tagging.class">FPN\TagBundle\Entity\Tagging</parameter>
</parameters>
<services>
<service id="fpn_tag.tag_manager" class="%fpn_tag.tag_manager.class%">
<argument type="service" id="doctrine.orm.entity_manager" />
<argument>\%fpn_tag.entity.tag.class%</argument>
<argument>\%fpn_tag.entity.tagging.class%</argument>
<argument type="service" id="fpn_tag.slugifier" />
</service>
</services>
</container>
I'd be happy to submit a PR for either.
Which is the best practise to handle forms?
I have a taggable Entity and i want a field how i can add tags to this entity in a form.
Hello how can i do to join an entity to a specific tag in a doctrine query builder?
I tried to do this
$qb->select('s')
->from('MyBundle:Site', 's')
->leftJoin(
'MyBundle:Tagging', 't',
\Doctrine\ORM\Query\Expr\Join::WITH, 't.resource_id = s.id'
)
but I get an error message => MyBundle\Entity\Tagging has no field or association named resource_id.
Someone have any idea?
Thank you in advance.
Repasted from: #2 (comment)
This also fixed my issue but raises another one (I think).
I don't think the autoloader should use 'DoctrineExtensions' as the key. I'm also using @l3pp4rd's doctrine extensions implemented in Symfony2 by @stof.
I'm still feeling my way around Symfony2 so I can't offer a pull request or clearly identify the issue. Happy to be told that I'm wrong but isn't there a chance of naming conflicts when using 'DoctrineExtensions'?
thx :)
I have added the following to my composer.json:
"fpn/tag-bundle":"dev-master"
When I run composer update I get the following error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for fpn/tag-bundle dev-master -> satisfiable by fpn/tag-bundle[dev-master].
- fpn/tag-bundle dev-master requires fpn/doctrine-extensions-taggable * -> no matching package found.
Problem 2
- fpn/tag-bundle dev-master requires fpn/doctrine-extensions-taggable * -> no matching package found.
- symfony/framework-standard-edition 2.2.x-dev requires fpn/tag-bundle dev-master -> satisfiable by fpn/tag-bundle[dev-master].
- Installation request for symfony/framework-standard-edition 2.2.x-dev -> satisfiable by symfony/framework-standard-edition[2.2.x-dev].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Somebody knows about creating hierarchical tags on FPNTagBundle?
It seems like the tagManager does not show the proper date when the tags are loaded.
/* @var $tagManager \FPN\TagBundle\Entity\TagManager */
$tagManager = $this->get('fpn_tag.tag_manager');
$tagManager->loadTagging($order);
While iterating over order.tags
in Twig, and making use of tag.createdAt
that field contains the date the Tag
itself was originally created.
In what way can I get the date the Taggable
Order originally was tagged?
Hello!
I faced with such exception:
FileLoaderLoadException: Cannot import resource "Z:\home\phototag\www\app/config\config.yml" from "Z:\home\phototag\www\app/config/config_dev.yml". (There is no extension able to load the configuration for "fpn_tag" (in Z:\home\phototag\www\app/config\config.yml). Looked for namespace "fpn_tag", found "framework", "security", "twig", "monolog", "swiftmailer", "assetic", "doctrine", "sensio_framework_extra", "fos_user", "phototag_core", "phototag_tag", "web_profiler", "sensio_distribution")
What could be wrong?
Hello,
I have try like in the document this code to find "medias" with a type of tag :
` $tagRepo = $this->getDoctrine()->getManager()->getRepository('DoctrineExtensions\Taggable\Entity\Tag');
// find all article ids matching a particular query
$ids = $tagRepo->getResourceIdsForTag('media', 'cd');
// get the tags and count for all articles
$tags = $tagRepo->getTagsWithCountArray('media');
foreach ($tags as $name => $count) {
echo sprintf('The tag "%s" matches "%s" medias', $name, $count);
} `
When I try , I have always the same error :
The class 'DoctrineExtensions\Taggable\Entity\Tag' was not found in the chain configured namespaces AppBundle\Entity, FPN\TagBundle\Entity
I know that the issue is with the ORM's mapping but I don't know how I can fixed that.
Thanks
I'd like to use the TagBundle within SonataAdminBundle. Any idea on how to achieve that?
In autoload.php:
$loader->registerNamespaces(array(
...
'DoctrineExtensions' => DIR.'/../vendor/doctrine-extensions-taggable/lib',
));
and in app/config.yml:
fpn_tag:
model:
tag_class: FPN\TagBundle\Entity\Tag
tagging_class: FPN\TagBundle\Entity\Tagging
fpn_tag:
model:
tag_class: Acme\TagBundle\Entity\Tag
tagging_class: Acme\TagBundle\Entity\Tag (should be tagging_class: Acme\TagBundle\Entity\Tagging)
Also in "Making an Entity Taggable" entity uses "$this->tags" but its not defined.
I was wondering, why using a very basic slug class instead of using doctrine sluggable behaviour ?
How to get tags array inside a taggable entity so I can write getTagsString() public function?
v.
I'm already using some doctrine extensions with the bundle gedmo/doctrine-extensions which include them all.
But your Bundle depends on fpn/doctrine-extensions-taggable
, which only includes the taggable behaviour of Doctrine Extensions.
How could I manage that, without having the same library twice ?
All done as documentation (with annotations) but i get this error:
Catchable Fatal Error: Argument 1 passed to DoctrineExtensions\Taggable\TagManager::loadTagging() must be an instance of DoctrineExtensions\Taggable\Taggable, instance of Acme\TagBundle\Entity\Document given, called in /project/src/Acme/TagBundle/Controller/DocumentController.php on line 111 and defined in /project/vendor/fpn/doctrine-extensions-taggable/lib/DoctrineExtensions/Taggable/TagManager.php line 201
Plus, when I send php app/console doctrine:generate:entities Acme I get this:
Generating entities for namespace "Acme"
[ErrorException]
Runtime Notice: Declaration of Acme\TagBundle\Entity\Tagging::setTag() should be compatible with DoctrineExtensions\Taggable\Entity\Tagging::setTag(DoctrineExtensions\Taggable\Entity\Tag $tag) in /projects/bazar/project/src/Acme/TagBundle/Entity/Tagging.php line 22
May you help me?
v.
I have followed your installation instructions to the letter, but when i try to run schema:update on my app i am getting the above error.
In my new Tag Entity:
@Orm\Table(uniqueConstraints={@UniqueConstraint(name="tagging_idx", columns={"tag_id", "resource_type", "resource_id"})})
Any Idea what i am doing wrong, or is this a bug
Hello! You can provide configuration files of mapping in YAML format?
Symfony\Component\Config\Definition\Exception\InvalidDefinitionException:
->cannotBeEmpty() is not applicable to concrete nodes at path "fpn_tag.model"
I followed the instructions in readme.md (using the Annotation version), and when I try to call $tagManager->loadOrCreateTag('reptile')
I receive the following errors:
[2/2] QueryException: [Semantical Error] line 0, col 50 near 'name IN('rep': Error: Class Vox\CoreBundle\Entity\Tag has no field or association named name
[1/2] QueryException: SELECT t FROM Vox\CoreBundle\Entity\Tag t WHERE t.name IN('reptile')
I couldn't get the XML version to worth either - it throws this error:
Class "Vox\CoreBundle\Entity\Tag" sub class of "FPN\TagBundle\Entity\Tag" is not a valid entity or mapped super class.
Additonally, I'm unable to call php app/console doctrine:generate:schema
due to the following error:
[Doctrine\DBAL\Schema\SchemaException]
There is no column with name 'resource_type' on table 'Tagging'.
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).
We need new branch for symfony 2.1 beta because there is require for symfony 2.0.x version in composer.json
In symfony 2.1 beta compatibility branch should have following line to be changed:
"symfony/framework-bundle": "2.0.*",
To:
"symfony/framework-bundle": "=v2.1.0-BETA1",
Without these changes in a new branch it is impossible to use this bundle with symfony 2.1 beta because this bundle with symfony 2.0.x requirement will make a confict in composer.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.