Answers.Body: <p>I can't answer the question fully without seeing your plugin code, but I'd suggest you generate your plugin scaffolding with <a href="https://pluginfactory.io/" rel="nofollow noreferrer">pluginfactory.io</a> to see how it all fits together.</p>
  
  <p>It's also helpful to look at a existing plugin that works; here's one I wrote that's pretty simple, and should be easy to follow: <a href="https://github.com/nystudio107/craft-fastcgicachebust" rel="nofollow noreferrer">FastCGI Cache Bust</a></p>
  
  <p>Roughly, you'd do something like:</p>
  
  <pre><code>PluginClass::getInstance()-&gt;serviceName-&gt;methodName();
  </code></pre>
  
  <p>Or if you do it the pluginfactory.io way:</p>
  
  <pre><code>PluginClass::$plugin-&gt;serviceName-&gt;methodName();
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-02T08:18:03.760Z
Answers.Text: Thanks andrew. Ironically I did use pluginfactory but was wondering what the on entry save  event  looks like in craft3. will dig in
Answers.UserDisplayName: joomkit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-30T03:09:48.247Z
Answers.LastActivityDate: 2018-06-30T03:09:48.247Z
Answers.UserDisplayName: andrew.welch
Body: <p>In my Craft 2 plugin my initial init function looked like:</p>
  
  <pre><code>public function init()
  {
      parent::init();
  
      if(!extension_loaded('imagick')) {
          PdfThumbnailerPlugin::log("imagick library not found - cannot make pdf thumbnails" , LogLevel::Warning);
          return;
      }
  
      craft()-&gt;on('entries.saveEntry', function(Event $event) {
           craft()-&gt;pdfThumbnailer_saveEntry-&gt;setThumb($event);
      });
  
      craft()-&gt;on('assets.saveAsset', function(Event $event) {
          PdfThumbnailerPlugin::log("on save asset");
          craft()-&gt;pdfThumbnailer_saveAsset-&gt;checkAsset($event);
      });
  
  }
  </code></pre>
  
  <p>I cannot understand (due to lack of devchops) or find an example of how to call my functions (which were in service files) in Craft3.</p>
  
  <p>I can see the constants used in the new style 'listener' but have no idea what or where these are referenced in the v3 docs. </p>
  
  <pre><code>    // Register our site routes
      Event::on(
          UrlManager::class,
          UrlManager::EVENT_REGISTER_SITE_URL_RULES,
          function (RegisterUrlRulesEvent $event) {
              $event-&gt;rules['siteActionTrigger1'] = 'pdfthumbnailer/save-entry';
              $event-&gt;rules['siteActionTrigger2'] = 'pdfthumbnailer/save-asset';
          }
      );
  </code></pre>
  
  <p>My plugin in craft 2 would create a thumbnail from the first page of a PDF asset.</p>
  
  <p>UPDATE:
  SO i eventually made some progress with :</p>
  
  <pre><code>Pdfthumbnailer::$plugin-&gt;SaveEntry-&gt;setThumb($event);
  </code></pre>
  
  <p>Except this kept saying it could not find service method:</p>
  
  <pre><code>Getting unknown property: joomkit\pdfthumbnailer\Pdfthumbnailer::SaveEntry 
  </code></pre>
  
  <p>It turns out that the method 'SaveEntry' only was found when named 'saveEntry'. Why would this be the case? (excuse pun)</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-02T11:39:26.330Z
Comments.Text: `SaveEntry` in your case is the name of a component. There is a function `registerComponents` you should check what parameters you pass to this function
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-02T11:53:38.977Z
Comments.Text: Brilliant Robin. Its defined in composer extra ->components->saveEntry
  Is this the norm for service declaration now?
Comments.UserDisplayName: joomkit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-02T11:54:18.570Z
Comments.Text: I suggest you to remove that part during development
Comments.UserDisplayName: Robin Schambach
Tags: <plugin-development><craft3>
Title: Plugin migration - calling services help
ThreadText: # Plugin migration - calling services help
  
  (Asked by: username_0 on 2018-06-29)
  
  In my Craft 2 plugin my initial init function looked like:
  
  ```
  public function init()
  {
      parent::init();
  
      if(!extension_loaded('imagick')) {
          PdfThumbnailerPlugin::log("imagick library not found - cannot make pdf thumbnails" , LogLevel::Warning);
          return;
      }
  
      craft()->on('entries.saveEntry', function(Event $event) {
           craft()->pdfThumbnailer_saveEntry->setThumb($event);
      });
  
      craft()->on('assets.saveAsset', function(Event $event) {
          PdfThumbnailerPlugin::log("on save asset");
          craft()->pdfThumbnailer_saveAsset->checkAsset($event);
      });
  
  }
  
  ```
  
  I cannot understand (due to lack of devchops) or find an example of how to call my functions (which were in service files) in Craft3.
  
  I can see the constants used in the new style 'listener' but have no idea what or where these are referenced in the v3 docs.
  
  ```
      // Register our site routes
      Event::on(
          UrlManager::class,
          UrlManager::EVENT_REGISTER_SITE_URL_RULES,
          function (RegisterUrlRulesEvent $event) {
              $event->rules['siteActionTrigger1'] = 'pdfthumbnailer/save-entry';
              $event->rules['siteActionTrigger2'] = 'pdfthumbnailer/save-asset';
          }
      );
  
  ```
  
  My plugin in craft 2 would create a thumbnail from the first page of a PDF asset.
  
  UPDATE:
  SO i eventually made some progress with :
  
  ```
  Pdfthumbnailer::$plugin->SaveEntry->setThumb($event);
  
  ```
  
  Except this kept saying it could not find service method:
  
  ```
  Getting unknown property: username_0\pdfthumbnailer\Pdfthumbnailer::SaveEntry 
  
  ```
  
  It turns out that the method 'SaveEntry' only was found when named 'saveEntry'. Why would this be the case? (excuse pun)
  
  **Tags:** plugin-development, craft3
  
  > **Comments:**
  > **username_1**: `SaveEntry` in your case is the name of a component. There is a function `registerComponents` you should check what parameters you pass to this function  
  > **username_0**: Brilliant username_1. Its defined in composer extra ->components->saveEntry Is this the norm for service declaration now?  
  > **username_1**: I suggest you to remove that part during development  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-06-30. Score: 1
  
  I can't answer the question fully without seeing your plugin code, but I'd suggest you generate your plugin scaffolding with [pluginfactory.io](https://pluginfactory.io/) to see how it all fits together.
  
  It's also helpful to look at a existing plugin that works; here's one I wrote that's pretty simple, and should be easy to follow: [FastCGI Cache Bust](https://github.com/nystudio107/craft-fastcgicachebust)
  
  Roughly, you'd do something like:
  
  ```
  PluginClass::getInstance()->serviceName->methodName();
  
  ```
  
  Or if you do it the pluginfactory.io way:
  
  ```
  PluginClass::$plugin->serviceName->methodName();
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks andrew. Ironically I did use pluginfactory but was wondering what the on entry save  event  looks like in craft3. will dig in  
  
  ---
  
  