Since there is already a post for relations I like a little word of explanation. So I have a table 'Admins' (id, role_id, no first name, login, password) and a table roles (id, role) [role = admin or super admin]. Grant me my logic tells me an admin has a role (admin role hasOne) and a role appratient an admin (admin role belongsTo).
PHP Code:
Code:
class Admin extends AppModel {
var $ name = 'Admin';
var $ hasOne = 'Role';
}
But when adding an admin, cake did not want this relationship so I reversed (I put in the hasOne and belongsTo role in admin) and it was willing?
Bookmarks