title: ConnectionManager getDataSource undefined method
body: <p>Using cakephp 2.3.8 I am attempting to setup a connection to a custom couchbase datasource I have made within another datasource. The datasource I am attempting to load functions properly on the rest of the site when being loaded via a model. I want to use the connection manager to load this datasource. This is what I have so far:</p>
  
  <p>database.php file:</p>
  
  <pre><code>public $queriesCB = array(  
      'datasource' =&gt; 'CouchbaseSource',
      'username'      =&gt; 'queries',
      'password'   =&gt; '',
      'bucket'        =&gt; 'queries', 
      'prefix'    =&gt; 'q_',
      'expiry'    =&gt; '1814400', //3 Weeks
      'autoConnect' =&gt; true, 
      'database'      =&gt; NULL , 
      'persistent' =&gt; false
      );
  </code></pre>
  
  <p>Within my other datasource trying to load couchbase datasource</p>
  
  <pre><code>$db = ConnectionManager::getDataSource("queriesCB"); 
  </code></pre>
  
  <p>When I debug $db I get this:</p>
  
  <pre><code>object(CouchbaseSource) {
          description =&gt; 'Couchbase DataSource'
          conObject =&gt; object(Couchbase) {
                  [private] _handle =&gt; resource
          }
          config =&gt; array(
                  'password' =&gt; '*****',
                  'database' =&gt; '*****',
                  'prefix' =&gt; '*****',
                  'datasource' =&gt; 'CouchbaseSource',
                  'username' =&gt; 'queries',
                  'bucket' =&gt; 'queries',
                  'expiry' =&gt; '1814400',
                  'autoConnect' =&gt; true,
                  'persistent' =&gt; false
          )
          prefix =&gt; 'q__'
          connected =&gt; false
          cacheSources =&gt; true
          configKeyName =&gt; 'queriesCB'
          [protected] _baseConfig =&gt; array()
          [protected] _descriptions =&gt; array()
          [protected] _sources =&gt; null
          [protected] _transactionStarted =&gt; false
  }
  </code></pre>
  
  <p>Now when I try to call this I get a error:</p>
  
  <pre><code>$db = ConnectionManager::getDataSource("queriesCB"); 
  $db-&gt;Get('test');
  </code></pre>
  
  <p>Error: Call to undefined method CouchbaseSource::Get(). </p>
  
  <p>This is a custom method, the datasource is all custom to work best with couchbase and the Get method does function properly. How am I setting up this connection wrong in cakephp?</p>
  
  <p>Edit:</p>
  
  <p>I just tested it with the default database config to a mysql database, it fails as well. The question now would be what would be the best way to initialize a new datasource? should I have to load a model with that datasource attached? Example: have a couchbase model with the datasource as couchbase?</p>
  
  <p>Edit: Here is some of the datasource</p>
  
  <pre><code>class CouchbaseSource extends DataSource { 
      public $description = 'Couchbase DataSource';
      public $conObject = NULL;
      public $config = NULL;
      public $prefix = NULL;
  
  
  public function __construct($config = array()){
  
      // If no configuration is set we use the default
      $this-&gt;config = $config; 
  
      // Setup the cache string that is used when building the string
      $this-&gt;prefix = (isset($this-&gt;config['prefix']) ? $this-&gt;config['prefix']."_" : "");
  
      if ($this-&gt;config['autoConnect']) {
          $this-&gt;connect();
      }
  
  }
  
  
  public function connect() {
      if ($this-&gt;conObject !== true) {
          try {
              $this-&gt;conObject = new Couchbase("127.0.0.1:8091", $this-&gt;config['username'], $this-&gt;config['password'], $this-&gt;config['bucket'], $this-&gt;config['persistent']);
          } catch (Exception $e) {
              throw new MissingConnectionException(array('class' =&gt; $e-&gt;getMessage()));
          }
      }
      return $this-&gt;conObject;
  }
  
  
  public function query($method, $params, $object) {
  
      // If not connected... reconnect!
      if(!$this-&gt;conObject) {
          $this-&gt;connect();
      }
  
      $apiMethod = $this-&gt;__methodToClass($method);
      if (!method_exists($this, $apiMethod)) {
          throw new NotFoundException("Class '{$apiMethod}' was not found");
      } else {
          return call_user_func_array(array($this, $apiMethod), $params);
      }  
  }
  
  
  private function __methodToClass($method) {
      return 'CB' . strtolower(Inflector::camelize($method));
  }
  
  
  public function describe(&amp;$Model) {
      return $this-&gt;description;
  }
  
  /////////////////////////////////////////////////
  // Query Methods
  /////////////////////////////////////////////////
  
  public function CBadd($key = NULL, $value = NULL, $expiry = NULL, $persisto = NULL, $replicateto = NULL) {
      return $this-&gt;conObject-&gt;add($key, $value, $expiry, $persisto, $replicateto);
  }
  </code></pre>