stephpy / timeline-bundle

Symfony2 bundle to make timeline
193 stars 57 forks source link

Only one spreader is getting registered #203

Closed vamsiikrishna closed 6 years ago

vamsiikrishna commented 7 years ago

I have 4 services ( in different bundles ) that are tagged as spy_timeline.spread but only one spreader is shown when I run php app/console spy_timeline:spreads

I just tried to move the service declaration to app/services.yml and only that spreader is getting registered.

Symfony version v2.8.17

stephpy/timeline-bundle v2.4.1

PHP 7.1

other services in the bundles are registered properly and working fine. it will be helpful if some one can point out why the issue is occurring .
Thanks !

Update :

when I run php app/console debug:container , all the services which are Spreaders are getting listed.

when I run php app/console debug:container example_spreader

it does show that it's tagged appropriately

Information for Service" example_spreader"

===============================================

Option Value
Service ID example_spreader
Class Example\Spreaders\ExampleSpreader
Tags spy_timeline.spread
Scope container
Public yes
Synthetic no
Lazy no
Synchronized no
Abstract no
Autowired no
vamsiikrishna commented 7 years ago

Update : defining a priority solves the issue. but still not sure if https://github.com/stephpy/timeline-bundle/blob/master/DependencyInjection/Compiler/AddSpreadCompilerPass.php#L20 is working as intended .

guilleferrer commented 6 years ago

same issue here. when not defining a priority only the first spread is being added

stephpy commented 6 years ago

Hi

Could you take a look on this compiler pass if there is all yours spreads which pass here

KoriSeng commented 6 years ago

Basically the sorting will be messed up if the spread has same priority. SpreadA: 10 SpreadB: 10

would result in an array that is [10=>[SpreadA,SpreadB]...] But after it is sorted, need to flatten the array back to [....,SpreadA,SpreadB....]

before calling the addMethodCall

It is a pain, when you you do not specify priority, especially when you use autowiring on Symfony 3.4+ by specifying a load all service path.

stephpy commented 6 years ago

Han, I see, could you make a PR please ?

stephpy commented 6 years ago

I see, you did it.