contao / manager-bundle

[READ-ONLY] Contao Manager Bundle
GNU Lesser General Public License v3.0
17 stars 10 forks source link

Support optional bundle dependencies #1

Closed dmolineus closed 8 years ago

dmolineus commented 8 years ago

I had a brief look to the manager bundle. As far I can see there is no support for optional bundle dependencies in the load after definition.

A use case first that could be an extension which would modify the calendar and news bundle but does not require that both are installed.

aschempp commented 8 years ago

Optional dependencies can be solved by checking for the existence of a bundle in your code. Either using class_exists or probably using in_array('…', $kernel->getBundles()).

I think that's sufficient?

dmolineus commented 8 years ago

So you suggest using class_exists('Contao\\NewsBundle\ContaoNewsBundle') in the plugin. Well, simple solution. Didn't come in my mind.

The kernel is not passed to the plugin as dependency so it's not available there. Maybe it could be passed as argument to the plugin constructors. If you don't think it's neccesary just close this ticket.

aschempp commented 8 years ago

well actually it does not make sense to pass the kernel, because it's the bundle loading process so there's information to get. yes, a simple class_exists should do for now :-)