Answers.Body: <p>Some things to check:</p>
  <ul>
  <li>Check that your info.xml has lines like this:
  <pre><code>&lt;classloader&gt;
    &lt;psr0 prefix=&quot;CRM_&quot; path=&quot;.&quot;/&gt;
    &lt;psr4 prefix=&quot;Civi\&quot; path=&quot;Civi&quot;/&gt;
  &lt;/classloader&gt;
  </code></pre>
  </li>
  <li>Clear civi cache: Administer - system settings - clear caches</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-07T21:09:16.117Z
Answers.Text: Great, it seems to be working, thanks! I saw this part in the info.yml but didn't realize it needed another classloader.
Answers.UserDisplayName: ItsMe
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-07T18:10:45.833Z
Answers.LastActivityDate: 2023-05-07T18:10:45.833Z
Answers.UserDisplayName: Demerit
Body: <p>This is my first module in CiviCRM and I have the example from the documentation but I can't get it to work. Every time I try to run in CiviCRM API Explorer v3 for attachments I get the following:
  Error: Class &quot;CRM_Dkbrapi_APIWrapper_Attachment&quot; not found in dkbrapi_civicrm_apiWrappers() (line 14 of [Drupal 9 Path]\sites\default\files\civicrm\ext\dkbrapi\dkbrapi.php).</p>
  <p>-&gt; dkbrapi.php</p>
  <pre><code>&lt;?php
  
  function dkbrapi_civicrm_apiWrappers(&amp;$wrappers, $apiRequest) {
    if ($apiRequest['entity'] == 'Attachment' &amp;&amp; $apiRequest['action'] == 'create') {
      if ($apiRequest['version'] == '3') {
        $wrappers[] = new CRM_Dkbrapi_APIWrapper_Attachment();
      }
    }
  }
  </code></pre>
  <p>Class file Attachment.php in CRM/Dkbrapi/APIWrapper</p>
  <pre><code>&lt;?php
  class CRM_Dkbrapi_APIWrapper_Attachment implements API_Wrapper {
    public function fromApiInput($apiRequest) {
      // do some stuff
  
      return $apiRequest;
    }
    public function toApiOutput($apiRequest, $result) {
       return $result;
    }
  }
  </code></pre>
  <p>What do i wrong?</p>
  
Tags: <drupal><api>
Title: Error: Class "CRM_Dkbrapi_APIWrapper_Attachment" not found in dkbrapi_civicrm_apiWrappers()
ThreadText: # Error: Class "CRM_Dkbrapi_APIWrapper_Attachment" not found in dkbrapi_civicrm_apiWrappers()
  
  (Asked by: username_0 on 2023-05-07)
  
  This is my first module in CiviCRM and I have the example from the documentation but I can't get it to work. Every time I try to run in CiviCRM API Explorer v3 for attachments I get the following:
  Error: Class "CRM\_Dkbrapi\_APIWrapper\_Attachment" not found in dkbrapi\_civicrm\_apiWrappers() (line 14 of [Drupal 9 Path]\sites\default\files\civicrm\ext\dkbrapi\dkbrapi.php).
  
  -> dkbrapi.php
  
  ```
  <?php
  
  function dkbrapi_civicrm_apiWrappers(&$wrappers, $apiRequest) {
    if ($apiRequest['entity'] == 'Attachment' && $apiRequest['action'] == 'create') {
      if ($apiRequest['version'] == '3') {
        $wrappers[] = new CRM_Dkbrapi_APIWrapper_Attachment();
      }
    }
  }
  
  ```
  
  Class file Attachment.php in CRM/Dkbrapi/APIWrapper
  
  ```
  <?php
  class CRM_Dkbrapi_APIWrapper_Attachment implements API_Wrapper {
    public function fromApiInput($apiRequest) {
      // do some stuff
  
      return $apiRequest;
    }
    public function toApiOutput($apiRequest, $result) {
       return $result;
    }
  }
  
  ```
  
  What do i wrong?
  
  **Tags:** drupal, api
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-05-07. Score: 1 | Accepted answer
  
  Some things to check:
  
  * Check that your info.xml has lines like this:
  
    ```
    <classloader>
      <psr0 prefix="CRM_" path="."/>
      <psr4 prefix="Civi\" path="Civi"/>
    </classloader>
  
    ```
  * Clear civi cache: Administer - system settings - clear caches
  
  > **Comments:**
  > **username_0**: Great, it seems to be working, thanks! I saw this part in the info.yml but didn't realize it needed another classloader.  
  
  ---
  
  