title: Create a custom resource webservice PrestaShop
body: <p>I create a module for PrestaShop 1.6 where I create a table as following in <strong>mymodule/mymodule.php</strong>:</p>
  
  <pre><code>class Mymodule extends Module {
  
      // Some code
  
      public function installDb() {
          return Db::getInstance()-&gt;execute("
          CREATE TABLE IF NOT EXISTS `" . _DB_PREFIX_ . "mytable`(
          `id_mdm` INT NOT NULL AUTO_INCREMENT,
          `id_category` INT NOT NULL,
          `service` INT NOT NULL,
          `title` VARCHAR(300) NOT NULL default '',
          `title_font_size` VARCHAR(128) NOT NULL default '',
          `title_color` VARCHAR(128) NOT NULL default '',
          `background_color` VARCHAR(128) NOT NULL default '',
          `border_style` VARCHAR(128) NOT NULL default '',
          `position` INT NOT NULL,
          `count` INT NOT NULL,
          PRIMARY KEY (`id_mdm`), UNIQUE (`id_category`)) ENGINE = InnoDB;");
      }
  
      // Some code
  
  }
  </code></pre>
  
  <p>It works fine, my table is created. Then I override webservice in <strong>mymodule/override/classes/webservice/WebserviceRequest.php</strong>:</p>
  
  <pre><code>class WebserviceRequest extends WebserviceRequestCore {
      public static function getResources() {
          $resources = parent::getResources();
          $resources['myresource'] = array(
              'description' =&gt; '',
              'class' =&gt; 'myresource'
          );
          ksort($resources);
          return $resources;
      }
  }
  </code></pre>
  
  <p>I create a new class called myresource in <strong>mymodule/override/classes/Myresource.php</strong>:</p>
  
  <pre><code>class MyresourceCore extends ObjectModel {
      public $id;
      public $id_mdm;
      public $id_category;
      public $service;
      public $title;
      public $title_font_size;
      public $title_color;
      public $background_color;
      public $border_style;
      public $position;
      public $count;
  
      public static $definition = array(
          'table' =&gt; 'mytable',
          'primary' =&gt; 'id_mdm',
          'fields' =&gt; array(
              'id_category' =&gt; array('type' =&gt; self::TYPE_INT),
              'service' =&gt; array('type' =&gt; self::TYPE_INT),
              'title' =&gt; array('type' =&gt; self::TYPE_STRING),
              'title_font_size' =&gt; array('type' =&gt; self::TYPE_STRING),
              'title_color' =&gt; array('type' =&gt; self::TYPE_STRING),
              'background_color' =&gt; array('type' =&gt; self::TYPE_STRING),
              'border_style' =&gt; array('type' =&gt; self::TYPE_STRING),
              'position' =&gt; array('type' =&gt; self::TYPE_INT),
              'count' =&gt; array('type' =&gt; self::TYPE_INT)
          )
      );
  
      protected $webserviceParameters = array();
  }
  </code></pre>
  
  <p>In the Back office I generate a key for <strong>myresource</strong>, but when I test in my browser <strong><a href="http://mydomain/api/myresource?ws_key=mykey" rel="nofollow noreferrer">http://mydomain/api/myresource?ws_key=mykey</a></strong>, there is the following error:</p>
  
  <pre><code>Fatal error: Class 'myresource' not found in /path/mydomain/classes/webservice/WebserviceRequest.php on line 502
  </code></pre>
  
  <p>I don't know why PrestaShop doesn't detect it. Thank you in advance for your assistance.</p>