phpcakephpcakephp-model

Cakephp:: Get data from others table?


I have this model called User, this model use "Users" table. This model is specially designed for admin to login. This model has "id, username, password, created, modified" fields.

Now, If I want to add more users, "normal users", users that can't login. What should I do?

Currently, I created new model called "Person", use "people" table, which has "id, username, email" fields.

From my admin panel(User model), how do I view the normal users(person model) data?


Solution

  • first, you are talking about authentication and authorization, you can check out the built-in acl and auth in cakephp.

    second, to use Person model

    $personModel = ClassRegistry::init('Person');
    $person = $personModel->findById($id);