The connection with the DB is supposed to be done by the model, not by
the controller. But it does not matter here.

Using the model or the controller, it does not work as expected.


On 9 out, 17:56, brian <[email protected]> wrote:
> Why use ClassRegistry::init() if this code is in your
> CompaniesController? You should be able to just do:
>
> $this->set('companies', $this->Company->getAll());
>
> Come to that, why even have a getAll() method?
>
> $this->set('companies', $this->Company->find('all'));
>
> On Fri, Oct 9, 2009 at 12:52 PM, rlcabral <[email protected]> wrote:
>
> > Yes, I was referring to the model names.
>
> > Right now the code is really simple because I'm trying to figure out
> > what is the problem.
>
> >        #app/controllers/companies_controller.php
> >        function admin_search() {
> >                $companies = ClassRegistry::init('Company')->getall();
> >                $this->set('companies', $companies);
> >        }
>
> > and the "getall" function in the model Company is:
>
> >        #app/models/company
> >        function getall() {
> >                return $this->find('all');
> >        }
>
> > Pretty basic, but does not work. However, If I change Company to City
> > or any other model, it works.
>
> > I don't wanna find all, but for now I'm doing this to see where the
> > problem is. Later I will put the term that I wanna search for.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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