Hi Mark,
thanks for taking the time to write back. However I am not entirely
sure what you mean. I tried to pass an integer to AppModel's
constructor which is called in TriadAPI's constructor but I am still
getting the same error which is:

Fatal error: Class 'TriadApi' not found in C:\vhosts\local.solowsc\app
\models\subscriber.php on line 2

This leads me to believe that triad_api.php is in the wrong location
to do what I want to do or that I am approaching this completely ass
backwards. So what is the correct way to deal with this? I suppose I
could just have one model that represents the API and place all my
methods in that. But thats going to get messy quickly as I will be
getting Subscriber data, TV Schedule data and Device data from the
API.

What is your opinion?


Thanks
Steve





On Sep 3, 2:10 pm, mark_story <mark.st...@gmail.com> wrote:
> You forgot all the parameters to the model constructor.
>
> http://api.cakephp.org/class/model#method-Model__construct
>
> -Mark
>
> On Sep 3, 11:00 am, RhythmicDevil <rhythmicde...@gmail.com> wrote:
>
> > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to