2

I'm writing a plugin, and used plugin.io to generate my scaffolding. In my controller I am attempting to call a service, and getting an error.

This is my service code from my generated plugin it lives at fulcrumdonation/services/FulcrumDonation_FulcrumCyberSourceService.php:

class FulcrumDonation_FulcrumCyberSourceService extends BaseApplicationComponent
{
    /**
     *
     * From any other plugin file, call it like this:
     *
     *     craft()->fulcrumDonation_FulcrumCyberSource->exampleService()
     */
    public function exampleService()
    {
    }
}

And just as the scaffolding suggests, I'm attempting to call this function in the controller:

craft()->fulcrumDonation_FulcrumCyberSource->exampleService();

But when I add that line of code in the controller I get the following error:

Property "Craft\WebApp.fulcrumDonation_FulcrumCyberSource" is not defined.

What am I missing here?

2
  • 2
    Looks like there's a mistake in my generator. Lo ciento, I will fix it Commented May 25, 2016 at 0:27
  • Awesome, thanks! And also, thank you @khalwat for your generator. You saved me a lot of work and research when beginning my first plugin. Commented May 28, 2016 at 2:29

1 Answer 1

4

Try it with a lowercase f in the middle...

craft()->fulcrumDonation_fulcrumCyberSource->exampleService();
2
  • Thank you so much! The plugin comment generator had it wrong! Commented May 25, 2016 at 1:24
  • 2
    I've since fixed this on pluginfactory.io Commented Jun 17, 2016 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.