Hi,

I'm trying to design my app to have fat models and skinny controllers
where possible but having a problem with one particular part of that:
retrieval of associated models.

I have models Foo and Bar, where (Foo hasOne Bar) and (Bar belongsTo
Foo), which map to DB tables 'foos' and 'bars' respectively.
When data is retrieved from the 'foos' table, it needs to be modified
for the controller - the obvious place for this is Foo::afterFind().
The trouble I have is if I do $this->Bar->find(...) then the
associated Foo data isn't passed through the Foo model, so those
modifications have to be performed in the BarController instead.

Am I missing something, approaching this in the wrong way, or is this
just the way it is?
Is there any way I can get around this without having to duplicate
code? The only idea that springs to mind is to make Foo::afterFind()
call a function Foo::modifyData() which the BarController can call as
well with the results.

I'm using CakePHP 1.1.18.5850 and PHP 5.2.4 on Win32. I can't upgrade
to v1.2 as this is part of a product we sell.

TIA,
--rob

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to