Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有三种不同类型的用户,它们具有不同的个人资料列。
我目前有用户表和组表,用户表链接到组。
如何设置它以便为每个组用户选择不同类型的配置文件?
您可以使用 $belongsTo 关系来链接两个表,这样每个用户都属于某个组。
为此,您需要创建用户模型。尝试类似下面的代码
class Users extends AppModel { var $name = 'Users'; public $belongsTo = array( 'Groups' => array( 'className' => 'Groups', 'foreignKey' => 'group_id' ) ); }