stephpy/timeline-bundle

Adding custom locators, docs say to update config, but you're using tagged services...

Closed this issue · 2 comments

In the documentation you mention a way to add your own locators:
https://github.com/stephpy/TimelineBundle/blob/master/Resources/doc/filter.markdown#add-your-own-locator

But after trying

filters:
            duplicate_key:
                priority: 10
            data_hydrator:
                priority: 20
                filter_unresolved: false
                locators:
                - milia_timeline.locator.user

I got an error: The service definition "milia_timeline.locator.user" does not exist.

I already found it strange you didn't do that with tagged services so I looked into the code and there I found:

https://github.com/stephpy/TimelineBundle/blob/master/DependencyInjection/Compiler/AddFilterCompilerPass.php

So I tried to do it with tags... and that worked

<service id="milia_timeline.locator.user" class="Milia\Timeline\Locators\UserLocator">
            <argument type="service" id="milia_user.view_model.provider" />
            <tag name="spy_timeline.filter.data_hydrator.locator" />
 </service>

I'm not sure if the documentation is outdated or if it should also work with updating your config.yml file

Hi,

Mmmmh indeed there is a mistake here.

I didn't advise to use tags because you may want to inject only "orm" or only "odm" locator ... DataHydrator by this way would be lighter.

This is why theses services are not using the tag.

And you have this error because i add locators into the extension and not a compiler pass here

I guess we should remove spy_timeline.filter.data_hydrator.locator tag and use a compiler pass to provide locators into the DataHydrator

Similar issue than #112 ...

Thanks for reporting this issue. I'll look at this this night or tomorrow, sorry for this mistake.

👍 thanks.