dongtiao2105 2015-02-23 15:22
浏览 41


I have a user model (Uprofile), a group model (Group) and a model that connects users with groups (GroupMembership). The table groupMemberships has group_id, uprofile_id and role fields.

Uprofile and Group both have a hasMany relation to GroupMembership. And GroupMembership has belongsTo to both.

I want to list Group with its assigned users and their roles.

How can this be done with CakePHP? I did not find an appropriate example.

  • 写回答

1条回答 默认 最新

  • douzhi7754 2015-02-25 11:35

    I am not sure if I am answering your question or if your question is vague.

    But this is a list of your Uprofile with role determined by group.

    $options = array(
    'fields' => array(
    'conditions' => array(
        'GroupMembership.group_id' => $group_id
    $list_of_uprofiles_and_roles = $this->GroupMemebership->find('all',$options);

    Does this answer you question?




  • ¥15 App的会员连续扣费
  • ¥15 不同数据类型的特征融合应该怎么做
  • ¥15 用proteus软件设计一个基于8086微处理器的简易温度计
  • ¥15 用联想小新14Pro
  • ¥15 multisim中关于74ls192n和DSWPK开关仿真图分析(减法计数器)
  • ¥15 基于8255的交通灯设计
  • ¥15 w3wp,exe 中发生未处理的 Microsoft ,NETFramework 异常。
  • ¥20 C51单片机程序及仿真(加减器)
  • ¥15 AQWA | 水动力分析 二阶波浪力
  • ¥15 c语言题目:成绩管理系统