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
> something that you are using. I will use an example from my world to
> illustrate.
>
> I have a Prototype Model, that is used in the PrototypesController. This
> model belongs to a Creator (from the users table), and belongs to a
> Designer (also from the users table). I have a User Model, that only
> handles the logic for logging in and out and user Identity stuff. So the
> User model doesn't have any relationship to the Prototype Model.
> I created a Designer Model, that extends the User Model. I can use this
> Designer Model just like the User model, because it inherits all the
> methods, but it can contain it's own relationships to Prototype. It doesn't
> always inherit the properties though, and I will tell you why I like
> that... because you can then do what you want as far as tables go, and
> datasources. So, just because you extend the User model, it doesn't mean
> that you have to use the users table... If how ever you need to get
> properties, you can access them via $this, if they are not static, and
> parent::someProperty if it is static.
>
> So, as I said in my Prototype Model I have a belongsTo Designer, so I use
> my Designer Model, and NOT the User Model, in that definition. Now in my
> PrototypesController I can access the Design model like any other related
> model using the chain.
> $this->Prototype->Designer->someMethodInEitherDesignerOrUserModel()
>
> If you are needing to initiate a model on the fly, that's not related, you
> can use ClassRegistry::init('Designer') OR if in a controller I think you
> can use $this->loadModel('Designer') (Which is just a helper to the first
> one) and use it the same way.
>
> Anyways, hope that helps. Let me know if I can clarify, or didn't explain
> anything clearly.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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

Reply via email to