[Coldbox 4.0.0] plugin removal

With the removal of plugins, what’s the best practice for migrating “plugin type” components? For instance, the upgrade docs says:

“With the removal of plugins, coldbox.system.Plugin no longer exists. If you have custom-written plugins that used some of the convenience variables such as controller, logbox, or wirebox that came from this base class, you’ll need to inject them using the appropriate injection DSL.”

What I’m interested in here is plugins that rely on the controller reference which (as noted) was available within a plugin - A good example might be the pagination plugin, for example.

Obviously one way would be to pass the controller to the plugin, i.e getInstance(“utils:paging”).init(controller) - but I can’t see a way of doing this with mixins, which is my preferred method.

What’s the general best practice here?



Just do this:

component {
property name=“controller” inject=“coldbox”;

It’s in the docs here:

Note, if there’s any logic in your init() that uses DI’d properties, move it to an onDIComplete() method.



ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Awesome - that’s exactly what I was after. Thanks Brad.