<p>Try it with a lowercase <code>f</code> in the middle...</p>

<pre><code>craft()-&gt;fulcrumDonation_fulcrumCyberSource-&gt;exampleService();
</code></pre>

CC BY-SA 3.0
2016-05-25T01:24:58.607Z
Thank you so much!  The plugin comment generator had it wrong!
danieltalsky
CC BY-SA 3.0
2016-06-17T20:02:42.363Z
I've since fixed this on https://pluginfactory.io
andrew.welch
CC BY-SA 3.0
2016-05-24T23:42:13.687Z
2016-05-24T23:42:13.687Z
Lindsey D
<p>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.</p>

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

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

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

<pre><code>craft()-&gt;fulcrumDonation_FulcrumCyberSource-&gt;exampleService();
</code></pre>

<p>But when I add that line of code in the controller I get the following error:</p>

<blockquote>
  <p>Property "Craft\WebApp.fulcrumDonation_FulcrumCyberSource" is not
  defined.</p>
</blockquote>

<p>What am I missing here?</p>

CC BY-SA 3.0
2016-05-25T00:27:41.187Z
Looks like there's a mistake in my generator. Lo ciento, I will fix it
andrew.welch
CC BY-SA 3.0
2016-05-28T02:29:38.037Z
Awesome, thanks!  And also, thank you @khalwat for your generator.  You saved me a lot of work and research when beginning my first plugin.
danieltalsky
<plugin-development><controller><services>
How do I call a service from my controller in a plugin?
# How do I call a service from my controller in a plugin?

(Asked by: username_0 on 2016-05-24)

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?

**Tags:** plugin-development, controller, services

> **Comments:**
> **username_1**: Looks like there's a mistake in my generator. Lo ciento, I will fix it  
> **username_0**: Awesome, thanks!  And also, thank you @khalwat for your generator.  You saved me a lot of work and research when beginning my first plugin.  

---

## 1 answers

### Answer by username_2 on 2016-05-24. Score: 4 | Accepted answer

Try it with a lowercase f in the middle...
craft()->fulcrumDonation_fulcrumCyberSource->exampleService();

> **Comments:**
> **username_0**: Thank you so much!  The plugin comment generator had it wrong!  
> **username_1**: I've since fixed this on https://pluginfactory.io  

---

