Re: Shared code for Models but not in AppModel

2011-12-08 Thread RhythmicDevil
Thats great Geoff thank you. On Dec 7, 5:08 pm, Geoff Douglas drdouglas...@gmail.com wrote: I think you have most elements i place... I think the thing that is getting confusing is how cake is suppose to load the classes. So here's the kicker. Cake only loads models if they are related to

Re: Shared code for Models but not in AppModel

2011-12-07 Thread RhythmicDevil
Guess I was right about sub classing with Cake. On Dec 6, 9:34 am, RhythmicDevil rhythmicde...@gmail.com wrote: Ok so I tried extending the AppModel class to a third level sub class but Cake fails to find it. Perhaps you can clue me in to where I am going wrong. I have the following

Re: Shared code for Models but not in AppModel

2011-12-07 Thread AD7six
On Dec 7, 1:55 pm, RhythmicDevil rhythmicde...@gmail.com wrote: Guess I was right about sub classing with Cake. what was your guess - that they work exactly the same way as the language itself? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out

Re: Shared code for Models but not in AppModel

2011-12-07 Thread RhythmicDevil
No actually. I created the file and class structure as shown above. I get an error from PHP saying class not found. So unless I have to add includes or requires to my files Cake does not load the classes. So Cake handles this just fine: AppModel-SubClass AppMode-AnotherSubClass But not this

Re: Shared code for Models but not in AppModel

2011-12-07 Thread AD7six
On Dec 7, 3:11 pm, RhythmicDevil rhythmicde...@gmail.com wrote: No actually. I created the file and class structure as shown above. I get an error from PHP saying class not found. So unless I have to add includes or requires to my files Cake does not load the classes. well, yes. since Cake

Re: Shared code for Models but not in AppModel

2011-12-07 Thread RhythmicDevil
Thanks man. I dont actually expect magic. Although Cake does do some things magically, I am never sure where the magic ends and my ignorance begins. In all my searching I never actually found a document that stated what you did. I realized that I could load the classes but was not sure if I was

Re: Shared code for Models but not in AppModel

2011-12-07 Thread Geoff Douglas
Where are you trying to use the Solidcore Model? I have done what you are explaining several times. Generally to apply different relationships to the same models, for better performance, and cleaner code. It is possible. And it is not breaking the Cake way to do it either. Cake is very

Re: Shared code for Models but not in AppModel

2011-12-07 Thread RhythmicDevil
Well the basic idea is that the application uses two datasources. One is the MySQL one the other is a custom one I wrote for our API. The Models that use the custom datasource require some methods and properties, I posted those in the initial question on this thread. Normally I would just put

Re: Shared code for Models but not in AppModel

2011-12-07 Thread Miles J
Cake just doesn't have a true autoloader so you need to include the file yourself or use the App class. On Dec 7, 12:38 pm, RhythmicDevil rhythmicde...@gmail.com wrote: Well the basic idea is that the application uses two datasources. One is the MySQL one the other is a custom one I wrote for

Re: Shared code for Models but not in AppModel

2011-12-07 Thread Geoff Douglas
I think you have most elements i place... I think the thing that is getting confusing is how cake is suppose to load the classes. So here's the kicker. Cake only loads models if they are related to something that you are using. I will use an example from my world to illustrate. I have a

Re: Shared code for Models but not in AppModel

2011-12-06 Thread RhythmicDevil
Ok so I tried extending the AppModel class to a third level sub class but Cake fails to find it. Perhaps you can clue me in to where I am going wrong. I have the following file structure: Models/ AppModel GtiApi Solidcore Here are what the class files contain: class AppModel

Shared code for Models but not in AppModel

2011-12-05 Thread RhythmicDevil
My application has two datasources. I use one to talk to MySQL for ACL. The other is a custom datasource that talks an API my company is developing. There are about 15 models that use the custom datasource and will probably be more. For each of those models I need to share methods and properties

Re: Shared code for Models but not in AppModel

2011-12-05 Thread Miles J
You could always just create 2 base models? class ApiBaseModel extends AppModel {} class DbBaseModel extends AppModel {} They both would extend AppModel to gain shared functionality and then both would have their own functionality. Cake IS PHP, so you can do whatever you want with classes.

Re: Shared code for Models but not in AppModel

2011-12-05 Thread RhythmicDevil
Hi Miles, thanks for the response. Yeah I think that would be the number 3 option I Iisted. The thing is how would I do the following: AppModel DbBaseModel SomeModel ApiBaseModel AnotheModel To the best of my knowledge you can actually build that kind of heirarchy in

Re: Shared code for Models but not in AppModel

2011-12-05 Thread Tilen Majerle
yes you can -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/12/5 RhythmicDevil rhythmicde...@gmail.com Hi Miles, thanks for the response. Yeah I think that would be the number 3 option I Iisted. The thing is how would I do the following: AppModel DbBaseModel SomeModel

Re: Shared code for Models but not in AppModel

2011-12-05 Thread Miles J
Are you referring to where the files go? You can do anything in Cake that PHP allows, so extend as many times as you please. On Dec 5, 11:54 am, RhythmicDevil rhythmicde...@gmail.com wrote: Hi Miles, thanks for the response. Yeah I think that would be the number 3 option I Iisted. The thing

Re: Shared code for Models but not in AppModel

2011-12-05 Thread RhythmicDevil
Yeah I had thought, and now have to go and check, that you could never extend passed one sub class from AppModel or AppController for that matter. I always thought that was odd but had something to do with cake's auto loaders. Thanks for the clue, I will check this out. On Dec 5, 3:11 pm, Miles

Re: Shared code for Models but not in AppModel

2011-12-05 Thread Miles J
Cake simply has trouble when trying to merge properties in one class with the AppClass. This should only be a problem with the AppController since you aren't defining many properties in AppModel. On Dec 5, 12:34 pm, RhythmicDevil rhythmicde...@gmail.com wrote: Yeah I had thought, and now have to