Use get_class to get "TestsControler" Chop the word "Controller" off, and then find the singular inflection of the word "Tests".
I don't know for sure, but I'm confident the logic is very similar to that. On Apr 25, 3:27 pm, 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 - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---