Thank you all for the reply. I get it now.

- harsh

On Apr 25, 3:09 pm, "DJ Spark" <[EMAIL PROTECTED]> wrote:
>   you probably have already figured it out, but it works like this:
>   - if you do not define a model (or an array of models) to your
> controller, cakePHP will automagically guess the model name by using
> the Singular UpperCamelCase form of your controller name. 'tests' ->
> 'Test' .
>  - if you use $uses = array('Model1', 'Model2'); in your controller,
> it'll check if those are ok, and you can access them directly.
>
>   remember you can always access related models, without the need of
> $uses =array('Model1', 'Model2'); :
> $this->Test->read();
>
> and if model Foo has *any* relation with test, you may try:
> $this->Test->Foo->read();
>
>  help it hopes
>  spark
>
> On 4/25/07, Pablo Viojo <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Take a look at the constructClasses method
> > (cake/libs/controller/controller.php) specially the line
>
> > $this->{$modelClass} =& $model;
>
> > Regards,
>
> > --
> > Pablo Viojo
> >  [EMAIL PROTECTED]
> >http://pviojo.net
>
> > On 4/25/07, cooked <[EMAIL PROTECTED]> wrote:
>
> > > rtconner,
>
> > > Thanks for your reply. But get_class will only get me name of the
> > > class from the actual object. I guess my question
> > > is really basic, though I don't have problem with it I just want to
> > > know it works. Here is an example, this is fundamental
> > > to cakePHP, and I am afraid I might be sounding really dumb.
>
> > > My Model
>
> > > class Test extends AppModel {
> > > ...
> > > ..
> > > }
>
> > > My Controller
> > > class TestsController extends AppController {
> > > ..
> > >          function index () {
> > >                $this->Test->save(...);     <=== My question is here,
> > > where did Test come from,
> > >          }
>
> > > }
>
> > > Hope I have made my question a little bit clearer. Test was never a
> > > variable of my Controller, then how
> > > can I access "Test".
>
> > > Thanks for bearing with me :-).
>
> > > On Apr 25, 2:10 pm, rtconner <[EMAIL PROTECTED]> wrote:
> > > > I think get_class() might be what you are looking for
> > > > php.net/get_class.
>
> > > > On Apr 25, 1:47 pm, cooked <[EMAIL PROTECTED]> wrote:
>
> > > > > I am new to cakePHP and i have things working pretty much, but one
> > > > > questions keeps bugging me. How does this work when I do this in the
> > > > > Controller
> > > > > $this->[MyModel]->func();
> > > > > Which variable in the controller stores the name of the Model. I have
> > > > > a lot of experience in C++/Java and I haven't seen anything like
> > > > > this.
> > > > > Is there some magic (like __call) happening in PHP which I don't know
> > > > > about.
>
> > > > > Thanks in advance.- Hide quoted text -
>
> > > > - Show quoted text -
>
> --
> [livesets]http://djspark.com.br/
> [web]http://synapsisdi.com.br- Hide quoted text -
>
> - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
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