Re: app_model to access a component

2007-09-15 Thread stab

Now to understand it :p

On Sep 15, 6:22 pm, AD7six <[EMAIL PROTECTED]> wrote:
> On Sep 15, 12:09 pm, stab <[EMAIL PROTECTED]> wrote:
>
>
>
> > I'm doing a bit of a hack to get some auto-transaction control for a
> > set of models.  The component is doing it's thing and saving down data
> > correctly.  So in app_model I have:
>
> > var $transaction_models =
> > array('Form','FormTemplate','FormRecord','FormGridRecord','FormExtended','Chain',
> > 'ChainDefault', 'wCase', 'Token', 'Workitem', 'EmailReminder',
> > 'CronJob', 'User');
>
> > function save($data) {
> > $result = parent::save($data);
> > if (in_array($this->name, $this->transaction_models) && 
> > !$result) {
> > AppController::checkTransactions();
> > }
> > }
>
> > The component can be called from any controller.  I cannot seem to
> > have access to that controller to access my Flow component like so
> > $this->controller->Flow->_checkTransactions(); so I use
> > AppController::checkTransactions(); to forward it on but that doesn't
> > seem to work either (although I can get to the function in
> > AppController).
>
> > Can anyone help shed some light on how I can do this effectively?
>
> That sounds a bit mixed up ;) but anyway: see the bakery article on
> observable models. Maybe that way you can put the M stuff in the M and
> leave the C stuff in the C.
>
> hth,
>
> AD


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: app_model to access a component

2007-09-15 Thread AD7six



On Sep 15, 12:09 pm, stab <[EMAIL PROTECTED]> wrote:
> I'm doing a bit of a hack to get some auto-transaction control for a
> set of models.  The component is doing it's thing and saving down data
> correctly.  So in app_model I have:
>
> var $transaction_models =
> array('Form','FormTemplate','FormRecord','FormGridRecord','FormExtended','Chain',
> 'ChainDefault', 'wCase', 'Token', 'Workitem', 'EmailReminder',
> 'CronJob', 'User');
>
> function save($data) {
> $result = parent::save($data);
> if (in_array($this->name, $this->transaction_models) && 
> !$result) {
> AppController::checkTransactions();
> }
> }
>
> The component can be called from any controller.  I cannot seem to
> have access to that controller to access my Flow component like so
> $this->controller->Flow->_checkTransactions(); so I use
> AppController::checkTransactions(); to forward it on but that doesn't
> seem to work either (although I can get to the function in
> AppController).
>
> Can anyone help shed some light on how I can do this effectively?

That sounds a bit mixed up ;) but anyway: see the bakery article on
observable models. Maybe that way you can put the M stuff in the M and
leave the C stuff in the C.

hth,

AD


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



app_model to access a component

2007-09-15 Thread stab

I'm doing a bit of a hack to get some auto-transaction control for a
set of models.  The component is doing it's thing and saving down data
correctly.  So in app_model I have:

var $transaction_models =
array('Form','FormTemplate','FormRecord','FormGridRecord','FormExtended','Chain',
'ChainDefault', 'wCase', 'Token', 'Workitem', 'EmailReminder',
'CronJob', 'User');

function save($data) {
$result = parent::save($data);
if (in_array($this->name, $this->transaction_models) && 
!$result) {
AppController::checkTransactions();
}
}

The component can be called from any controller.  I cannot seem to
have access to that controller to access my Flow component like so
$this->controller->Flow->_checkTransactions(); so I use
AppController::checkTransactions(); to forward it on but that doesn't
seem to work either (although I can get to the function in
AppController).

Can anyone help shed some light on how I can do this effectively?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---