Git Product home page Git Product logo

doctrineextensions-taggable's People

Contributors

benjamindulau avatar sebastien-cas avatar ternel avatar weaverryan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

doctrineextensions-taggable's Issues

Can't extend the Tag mapping with a discriminator

Hi!

I'm trying to add a discriminator to my Tag entity,
because I don't want project wise Tag but only "Client" specific tags (a group of user own their tags, the others groups can't use them). So I have my TagManager service, extending the one from FPNTagBundle and everything is working fine,
except one thing.

I can't set the "name" property of the Tag object not unique (metadata/DoctrineExtensions.Taggable.Entity.Tag.dcm.xml).

This is a deal breaker and I will not be able to use this extension unless the constraint is made optional (I don't know how) as :

  • we can't redeclare the $name property (Doctrine throw a mapping exception: Duplicate definition of column 'name' on entity 'My\Bundle\AwesomeBundle\Entity\Tag' in a field or discriminator column mapping.)
  • extending the Tag object from DoctrineExtensions-Taggable is mandatory (type hinted everywhere), I can't just go with my own

I don't know if discriminator is something that should be made possible with this extension,
at the moment my only alternative if to fork the project and edit the metadata/DoctrineExtensions.Taggable.Entity.Tag.dcm.xml file to remove the constrain, maybe there is something that can be done in a more clever way?

saveTagging function removes old tags from the taggable resource

saveTagging function manipulates taggable resource property tags ($newTags = $resource->getTags()), which is an ArrayCollection, leaving the taggable resource stale tag-wise.

I guess it should be using '$newTags = new ArrayCollection($resource->getTags()->toArray())' if it's always an ArrayCollection.

Meanwhile I have to reload tags after saving them :(

FeatureRequest, use Traits

Hi! I think you should provide a starndard trait implementing the Taggable Interface.
Then usage would be easier.

Tag a stable release

You should tag a stable release, to use in FPNTagBundle.
Otherwise, simply requiring "fpn/tag-bundle": "dev-master" wouldn't work, since in last releases Symfony enforces an higher minimum stability

Tag serializer

Can I overwrite the way the tag object gets serialized? Currently everything is returned, I'd like to exclude the id, created_at, updated_at and tagging.

This is my setup, I'm thinking setting the parent of the Tag Bundle to FPN when the namespace of the Entity is actually DoctrineExtensions could be the issue.

# app/config/config.yml
# ...
jms_serializer:
    metadata:
        auto_detection: true
        directories:
            TagBundle:
                namespace_prefix: "DoctrineExtensions\\Taggable"
                path: "@MYTagBundle/Resources/config/serializer/fpn"
# MY\TagBundle\Resources\config\serializer\fpn\Entity.Tag.yml
DoctrineExtensions\Taggable\Entity\Tag:
    exclusion_policy: ALL
    properties:
        id:
            expose: false
        name:
            expose: true
        created_at:
            expose: false
        updated_at:
            expose: false
        tagging:
            expose: false
# src/MY/TagBundle/MYTagBundle.php
<?php

namespace MY\TagBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class MYTagBundle extends Bundle
{
    public function getParent()
    {
        return 'FPNTagBundle';
    }
}

Incomplete readme files

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.

Method getResourceIdsForTag of my entity Tag, not working

When i get repository for class Tag in controller:
'''
$tagRepo = $this->getDoctrine()->getManager()->getRepository(mybundle:Tag);
'''
and then call the method "getResourceIdsForTag" :
'''
$tagRepo->getResourceIdsForTag('my_resource', 'my_tag);
'''
Return the error ###ndefined method 'getResourceIdsForTag'. The method name must start with either findBy or findOneBy!###

The problem is that my entity (It is extending the BaseTag entity, as it is written in the documentation) not view the entityRepository located in the doctrine-extension-taggable.

Actually I solved my problem by creating my EntityRepository copying the code from TagRepository located inside doctrine-extension-taggable.

Maybe I wrong something ?
Thanks a lot

Tag queries should use slug instead of name

Hello,

Nice work on this bundle.

I've some trouble to figure out why the tag queries use the name attributes instead of the slug.
As the slug guarantees the unicity of a tag, asking for a tag which does correspond to the slug but the name should return the given tag.
This behavior should also be working when getting ressources from a tag.

Considering the tag "This is a tag", and its slug "this-is-a-tag", then

$tagRepo->getResourceIdsForTag('article_tag', 'this-is-a-tag'));

should return all the ressources linked to "This is a tag". In this case, nothing will be returned as the tag corresponds to nothing existing in name colum of tag table.

Taggable::getTaggableType() should be declared static

Since all instances implementing DoctrineExtensions\Taggable\Taggable must share the same taggable type, the Taggable::getTaggableType() should be declared static, in order to do this:

$em->getRepository('Tag')
    ->getResourceIdsForTag(MyEntity::getTaggableType(), 'my-tag');

instead of:

$em->getRepository('Tag')
    ->getResourceIdsForTag('hard_coded_type_string', 'my-tag');

Integrity constraint violation on long tag names

Hello,

Not necessarily a big bug, but if you have tag names that get truncated on the database level (50 characters in length), you will get an integrity constraint violation when adding the tag again.

Uncertain if this should be fixed on the TagManager level or in user-land..

Depending on what you decide, I can provide a Pull Request..

Best Regards,
Khez

feature Request, Tags Groups

Hi,

I'm intending to use the tags bundle for an app that will need to handle taggable entities for different organizations, I don't want Tags defined by Organization A to be visible by Organization B, e.g. lets say I have both Ford and Chevrolet as clients, in the same App, I need to handle tags separately.

I thought Tag groups'd handle that situation. By extending the API with an optional $group attribute that defaults to 'default'.

I'm trying to implement that, might be sending a pull request. :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.