GithubHelp home page GithubHelp logo

bee-lab / beelabtagbundle Goto Github PK

View Code? Open in Web Editor NEW
46.0 46.0 18.0 108 KB

๐Ÿท A simple implementation of tags for Symfony and Doctrine ORM

License: GNU Lesser General Public License v3.0

PHP 100.00%
bundle php symfony symfony-bundle tag

beelabtagbundle's People

Contributors

dfridrich avatar garak avatar grahamcampbell 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

beelabtagbundle's Issues

Tag listener incorrect response after use jms18 for translation

i have a form for adding a product to my list. (tags added here)
and another form for adding some specification for it. (like color, ...)
without use translation, everything ok.
BUT
after using translation (JMS18) second form delete tags.
whats wrong?

Programmaticaly tags addition

Hi!
Nice and clear bundle, thank you for your work!
I have problem/proposition: I need to add/remove tags from my services.
Now, bundle only allow to add tags via listener.
What do you think, @garak it will be better, if we can have some service that manages tags and its relations?
Inside listener we can call such service and avoid copypasting.
If you agreed my idea, I can try to PR it.

Not possible to remove all tags

If I have an entity with at least one tag and I try to remove all tags (so it has no more tags), the change will not be persisted.

As a removal of all tags is registered as an update event as well (due to the updatedAt), the important part will be skipped because $tagNames will be NULL and skipped at:

    protected function setTags(TaggableInterface $entity, $update = false)
    {
        ...
        if (empty($tagNames)) {
            return;
        }
        ...
    }

This makes it impossible to remove all tags from an entity.

Error on partial load

Hi,

I have an issue with saving a partialy selected entity, situation is as follows:

Data is retrieved partialy to avoid fetching excessive amounts of data. i am only interested in the 'something' and 'taggable' entities, not the tags themselves

    public function getSometing()
    {
        $query = $this
            ->createQueryBuilder('something')
            ->select('something, taggable')
            ->join('something.taggable', 'taggable')
            ...
            ->getQuery();
        $query->setHint(\Doctrine\ORM\Query::HINT_FORCE_PARTIAL_LOAD, 1);
        return $query->getResult();
    }

When editing and flushing the 'taggable' entity, symfony crashes with the following error:

..._logger.ERROR: Warning: Invalid argument supplied for foreach() ["[object] (Symfony\Component\Debug\Exception\ContextErrorException(code: 0): Warning: Invalid argument supplied for foreach() at /data/www/public_html/vendor/beelab/tag-bundle/Listener/TagSubscriber.php:124)"] []

In the setTags method the code assumes $oldTags is an array:

protected function setTags(TaggableInterface $entity, $update = false)
    {
        ...
        // if updating, need to check if some tags were removed
        if ($update) {
            foreach ($oldTags as $oldTag) {                                        //<- line 124
                if (!in_array($oldTag->getName(), $tagNames)) {
                    $entity->removeTag($oldTag);
                }
            }
        }
        ...
    }

Since the field has not been hydrated and also the constructor is not called, $oldTags is null in stead of an empty ArrayCollection, causing the flush to fail.

Can you have a look at this please?
Thanks!

Symfony 6 Support

Do you have a roadmap or timeline for when this bundle might be Symfony v6 compatible?

Readme.md / documentation

Hello,

I am trying to use your library, but I couldn't manage to make it work until now, I created a StackOverflow post but didn't received any help from it.

I know this is not the right place as it is for issues, but I don't know where to ask anymore. Could you give me some more information about how to use your library ?

Thanks a lot.

Updating Without TagsText?

Am I right in thinking that if I have an entity that I've previously tagged, if I simply load the entity, change something unrelated to tags on it, and then persist it, that it will lose all the tags? (Because the TagSubscriber setTags method relies on you having called getTagsText/setTagsText, and if you haven't, it will think you mean to remove all the tags?)

Or am I possibly doing something dumb? :)

Error on install with SF4

in a fresh install with composer, i get this msg. whats wrong?

Compile Error: Declaration of App\Entity\Tag::setName($name) must be compatible with Beelab\TagBundle\Tag\TagInterface::setName(?string $name): void

Tagged Entity count

Hi,
I would like to store a count of how much a tag is used.
So I thought about the possibility do add a field to TagEntity to store that value. I also need to add a event listener that make the count query (on every add tag persist) and then update the count value in the Entity.

Do you think that it can works?
My only doubt are on the listener, because your Bundle listen for onflush event and I don't know if this can be a problem.

I want to store the count because I have to make a "tag cloud", something like this: http://mistic100.github.io/jQCloud/

Thanks for your work!

Field(s) 'tagsText' doesn't exist

I'm trying to make tags in translations.
I use Symfony 5.0.7, Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface, Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait and A2lix\TranslationFormBundle\Form\Type\TranslationsType
If I set tags in not translatable entity everything is OK, but when I moved it to Translatable Entity, set to FormType
$builder->add('translations', TranslationsType::class, array(
'fields' => array(
'title' => array('field_type' => TextType::class),
'slug' => array('field_type' => TextType::class),
'tagsText' => array('field_type' => TextType::class, array('label' => 'Tags:'))));

I received error: Field(s) 'tagsText' doesn't exist in App\Entity\BlogTranslation

When I try to call in FormType only
$builder->add('translations', TranslationsType::class);
at view there aren't any tag input field

Is it possible to make tags in translatable entity?

Symfony 5 support

First, I would like to thank you all for the amazing bundle.

When installing the bundle in a Symfony 5 project with Flex, composer fails with this message:

$ composer require beelab/tag-bundle

Using version ^1.4 for beelab/tag-bundle
[...]
Restricting packages listed in "symfony/symfony" to "5.0.*"
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - beelab/tag-bundle v1.4.1 requires symfony/config ^3.4 || ^4.0 -> no matching package found.
    - beelab/tag-bundle v1.4.0 requires symfony/config ^3.4|^4.0 -> no matching package found.
    - Installation request for beelab/tag-bundle ^1.4 -> satisfiable by beelab/tag-bundle[v1.4.0, v1.4.1].

I suppose it is a matter of compatibility with Symfony 5. I would deeply appreciate an update introducing support for this version if that is the case.

The child node "tag_class" at path "beelab_tag" must be configured.

Hi,

I'm using Symfony 4 and I have this error :

The child node "tag_class" at path "beelab_tag" must be configured.

It is written in your documentation that you have to configure the Bundle in app / config / config.yml but in Symfony 4 this file does not exist anymore

How can i configure it ?

Thanks in advance

All database data erased

Hello,

It's the third time it happen to me. All tags in database disappear, loosing all. Thanks to daily backups I can inject them back, but it's getting annoying.. I didn't updated the related entities attached to those tags, so I don't really know where the problem is coming from.

Is this en event that can occur if I misconfigured something in this plugin ?

Error on setup

my entity show me this error:

TagInterface $tag) must be compatible with Beelab\TagBundle\Tag\TaggableInterface::ad dTag(Beelab\TagBundle\Tag\TagInterface $tag): void

whats wrong?

jquery cookbook not helped

i try to implement the jquery cookbook but it not help. the steps is too complicated. please help me.

Update impossible SF4

Don't really know if this is an issue or not!?

Even if I implement the update variable in the setTagsText function, the update is triggered but the tags aren't updated? Looks like the entity isn't populated with the new values :(

Note : I've tried to extend the AbstractTaggable, same problem :/

Any idea on how to fix this issue ?

Symfony 4 support

Hi there.
As i can see in your code you have added support for symfony4. But there is a problem, when i try to install your bundle, i get next error:
"- beelab/tag-bundle v1.2.0 requires symfony/symfony ^2.8|^3.2 -> satisfiable by symfony/symfony"

I checked tag in your repo, and i see that v1.2.0 tag points to source code from Jan 2017.
Can you update tag of your repo to current source code?

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.