Meas
Meas

Reputation: 212

How to use function find('list') get data from other table beside its model?

I am new of Cakephp I stuck by using function find('list') to get data from other table inside User model. Example i have User Model want get List of group andgroup has table "groups" but i don't want create php files for group controller and group model.

    <?php
      //User model
       class User extends AppModel {

         public function getGroupList() {
            /* Here i want return list all group by use function find('list') 
             * but group has table name "groups" and i don't want use sql query string.
             * Note that group i don't create  files php in controller and model.
             */

         }

       } 
    ?>

Upvotes: 0

Views: 150

Answers (1)

Daniel
Daniel

Reputation: 445

Why don't you want to create a groups controller? Doing things cakes way will often make your life easier.

There will be an extra sql query (or join at least) involved in either case.

Upvotes: 1

Related Questions