3

I'm trying to build my first plugin using a service but i can't seem to get it to work.

The file is named CampaignReports_CampaignMonitorService.php and it's in the services folder of my plugin.

This is the code of the service:

class CampaignReports_CampaignMonitorService extends BaseApplicationComponent
{

    public function __construct()
    {        

    }

    public function getSettings()
    {
        return true;
    }
}

I'm calling the service as follow:

craft()->campaignReports_CampaignMonitor->getSettings();

This causes an internal server error with the following message:

Internal Server Error

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

Any idea what i'm doing wrong? Probably some naming convention I haven't followed exactly but I just don't find it

5

Looks like a casing issue to me. You should be calling:

craft()->campaignReports_campaignMonitor->getSettings();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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