public function __construct(Model $Account, $databaseConnectionName) { $this->Account = $Account; $this->databaseConnectionName = $databaseConnectionName; $this->Account->setConnection($databaseConnectionName); }
/** * Create a new account * * @param array $data * An array as follows: array('name'=>$name, 'key'=>$key, 'balance_type'=>$balanceType, * 'account_type_id'=>$accountTypeId, 'parent_account_id' => $parentAccountId, 'organization_id'=>$organizationId * ); * * @return boolean */ public function create(array $data) { $Account = new Account(); $Account->setConnection($this->databaseConnectionName); $Account->fill($data)->save(); return $Account; }