Hi, I have an app. It has to get data from two different sources, a mysql db and an XML API
For the API model I want to be able to do the following: TriadAPI - extends AppModel contains generic query and connection info Subscriber - extends TriadAPI and contains subscriber specific queries I am also using a data source called soap_source. The problem I have is that I dont have any idea where to put the TriadAPI file so that it gets loaded. The reason I want to do this is that I dont want to repeat the generic query and connection info. It makes senses to me that the hierarchy should look like this: AppModel -> TriadAPI -> Subscriber I cant modify AppModel as that will screw up the models that need to use the DB. At least I think thats that would happen. I have pasted my model classes below for reference. Thanks for any advice. /app/models/triad_api.php class TriadApi extends AppModel { /** * @var useDbConfig * @description The name of the DataSource connection that this Model uses. Defined in core/database.php */ public $useDbConfig = 'soap'; public $useTable = false; public $TransactionParams = array (); public function __construct() { parent::__construct(); $api_config = Configure::read('API'); $this->TransactionParams['loginName'] = $api_config ['loginName']; $this->TransactionParams['loginPassword'] = $api_config ['loginPassword']; $this->TransactionParams['orgName'] = $api_config['orgName']; $this->TransactionParams['transaction']['id'] = date('d-m-y- i:s:a').' - '; $this->TransactionParams['transaction']['wait'] = $api_config ['wait']; $this->TransactionParams['transaction']['version'] = $api_config['version']; $this->TransactionParams['transaction'] ['TransactionCommandList'] = array (); } public function formatResult($result) { return $result->transactionResult; } public function queryDatabase() { //stub } } /app/models/subscriber.php class Subscriber extends TriadApi { public function __construct() { parent::__construct(); } public function QuerySub($SubscriberId) { $this->TransactionParams['transaction']['id'].'QuerySub'; $this->TransactionParams['transaction'] ['TransactionCommandList']['TransactionCommand']['QuerySub'] ['SubscriberId'] = $SubscriberId; return $this->formatResult($this->query('SendTransaction', $this->TransactionParams)); } /* * <QuerySubNRC> * <SubscriberId> subscriber_id </SubscriberId> * </QuerySubNRC> */ public function QuerySubNRC($SubscriberId) { $this->TransactionParams['transaction']['id'].'QuerySubNRC'; $this->TransactionParams['transaction'] ['TransactionCommandList']['TransactionCommand']['QuerySubNRC'] ['SubscriberId'] = $SubscriberId; return $this->formatResult($this->query('SendTransaction', $this- >TransactionParams)); } /* * <PerformSubOp> * <SubscriberId> subscriber_id </SubscriberId> * <Operation> operation </Operation> * </PerformSubOp> */ public function PerformSubOp($SubscriberId) { $this->TransactionParams['transaction']['id'].'PerformSubOp'; $this->TransactionParams['transaction'] ['TransactionCommandList']['TransactionCommand']['PerformSubOp'] ['SubscriberId'] = $SubscriberId; $this->TransactionParams['transaction'] ['TransactionCommandList']['TransactionCommand']['PerformSubOp'] ['Operation'] = 'Refresh'; return $this->query('SendTransaction', $this- >TransactionParams); } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---