예제 #1
0
 /**
  * Constructor
  *
  * @param mixed $id The id to start the model on.
  * @param string $table The table to use for this model.
  * @param string $ds The connection name this model is connected to.
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     Configure::config('default', new PhpReader());
     Configure::load('mailchimp', 'default');
     // Set-up mailchimp
     $this->apikey = Configure::read('mailchimp_apiKey');
     $this->__api = new MCAPI($this->apikey, true);
     // Bit hacky, we need to tell the MCAPI class
     // which dbConfig to use, but we can't add a method on
     // to the production MCAPI class, so we have to check if
     // it exists first.
     if (method_exists($this->__api, 'setConfig')) {
         $this->__api->setConfig($this->useDbConfig);
     }
 }