Monday, June 29, 2009

Re: Models and SOAP

How about a little class hierarchy?
 
Soap extends AppModel and Suscriber-Device extend Soap
 
You put that in Soap's constructor and then just super() it in Suscriber-Device

2009/6/29 RhythmicDevil <rhythmicdevil@gmail.com>

Hi,
some of my application's models will use SOAP or MySQL. I am trying to
figure out where to put the common SOAP stuff.

User Model will use MySQL
Subscriber Model will use SOAP
Device Model will use SOAP

In my SOAP models I need to have this:

       $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 ();

Currently this sits in the constructor for Subscriber but I know thats
wrong as I would then have to repeat that for each subsequent model
that uses SOAP. I am using this for my datasource:
http://www.pagebakers.nl/2008/12/18/soapsource-a-soap-client-datasource-for-cakephp/

I thought a behavior would be the trick but I am not sure. The docs
dont seem to point in that direction.
I dont want to extend app_model because that would then add it to the
models that use MySQL.

Any ideas?

Thanks. --~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: