Accessing Plugins like "Validator" from a CFC


I'm getting this error in a Bean I'm trying to use:

Message Variable GETPLUGIN is undefined.

It works fine in my handlers, and I think I know why its not working
but my the fix I've tried hasn't worked out. Here is my CFC. This is
my first try with script CFCs, so if you see anything wrong, kindly
let me know.

  Component displayname="myBean" accessors="true" ouput="false"
autowire=true {

    property name="validator" type="coldbox:plugin:Validator"
    property name="firstname" getter="true" setter="true" type="string";
    property name="lastname" getter="true" setter="true" type="string";

    public array function validate() {
      var validator = getPlugin('Validator');

How can I use the plugin here in my bean or should I do this a
different way?



I think you will need to pass in the constructor the controller, then you
will need to use that to get the plugin.

I might be wrong, but I don't think it is injected by default without being
wired up with lightwire or ColdSpring.


property name="validator"

public array function validate() {
      var validator = instance.validator;

By autowiring with coldbox:plugin:Validator you are placing the
validator plugin into the instance scope, do no need for getPlugin and
yes, it doesn't' exist.

Hope that helps you out. You don't need lightwire or Coldspring for
this type of injection.

Note if you're are running Coldbox 3.0 autowireing via inject instead of
type is preferred.

property name="validator"

Curt Gratz
Computer Know How