Re: Moving methods to AppModel

2006-10-23 Thread AD7six
If it's an abstract class, put it on thesame level as your app_controller model, if it's not wrap the class defenition in if(class_exists(Cart)) { ... } HTH, AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Moving methods to AppModel

2006-10-23 Thread Sonic Baker
Hi AD7six,It's not an abstract base class so I went for the latter option. I assume you mean: if(!class_exists (CartModel)) {...// CartModel class definition...}This seems to work but why??? How is the Class already being defined?Cheers,Sonic

Re: Moving methods to AppModel

2006-10-23 Thread AD7six
I noticed the missing ! as I pressed send ;). The 'problem' is only that all the files in yoru models directory are loaded by cake, and the order they are loaded depends on their name (which is dictated by convention). therefore: if you try to extend a class that isnĀ“t loaded when the model

Re: Moving methods to AppModel

2006-10-23 Thread Sonic Baker
On 10/23/06, AD7six [EMAIL PROTECTED] wrote: using class_exists is a bit of a hack but avoids problems. Anyway, hth,AD7sixThanks AD7six,It certainly does help.Cheers,Sonic --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Moving methods to AppModel

2006-10-22 Thread Sonic Baker
Hi Ralph,Here's one of the explanations that brought the composite pattern to my attention: http://devzone.zend.com/node/view/id/7Incidental I'm having trouble getting the Inheritance method to work. I keep getting: Fatal error: Cannot redeclare class cartmodel in

Re: Moving methods to AppModel

2006-10-21 Thread [EMAIL PROTECTED]
Very interesting. The inheritance method sounds really good to me, in fact one which I now intend to use. But, just for comparison, what would be the composite approach, Sonic? I couldn't quite follow your first email in that regard. --~--~-~--~~~---~--~~ You

Moving methods to AppModel

2006-10-20 Thread Sonic Baker
Hi,I have a model method which I'd like to use in two different models. If I move it into AppModel it'll get loaded for every model which I could be inefficient (IIRC). So as far as I can see I have 3 further choices. 1. Include the Model in the $uses[] array of the controller I want to call the

Re: Moving methods to AppModel

2006-10-20 Thread [EMAIL PROTECTED]
2. Make an intermediate model; inherit this from AppModel and Inherit the two models from this. that was the first thing i thought about too. and i think it's the cleanest, best, most-OO way ;-) --~--~-~--~~~---~--~~ You received this message because you are

Re: Moving methods to AppModel

2006-10-20 Thread Sonic Baker
On 10/20/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: 2. Make an intermediate model; inherit this from AppModel and Inherit the two models from this.that was the first thing i thought about too.and i think it's thecleanest, best, most-OO way ;-) Hi Deiter,Thanks for your advice. I was reading

Re: Moving methods to AppModel

2006-10-20 Thread Marcelo de Moraes Serpa
Well, don't take composite over inheritance too serious. There are times where inheritance is the best way, no doubt.On 10/20/06, Sonic Baker [EMAIL PROTECTED] wrote: On 10/20/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: 2. Make an intermediate model; inherit this from AppModel and Inherit

Re: Moving methods to AppModel

2006-10-20 Thread Sonic Baker
Hi Marcelo,Thanks for your input. Taken on board.Cheers,Sonic --~--~-~--~~~---~--~~ 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