示例#1
0
 /**
  * Gets the content's member groups
  * @param Content $content
  * @return Membergroup[] Returns the member groups assigned to the content
  */
 static function ContentMembergroups(Content $content)
 {
     if (!$content->Exists()) {
         return array();
     }
     $sql = Access::SqlBuilder();
     $tblCmg = ContentMembergroup::Schema()->Table();
     $tblMg = Membergroup::Schema()->Table();
     $join = $sql->Join($tblCmg);
     $joinCondition = $sql->Equals($tblCmg->Field('MemberGroup'), $tblMg->Field('ID'));
     $where = $sql->Equals($tblCmg->Field('Content'), $sql->Value($content->GetID()));
     $orderBy = $sql->OrderList($sql->OrderAsc($tblMg->Field('Name')));
     return Membergroup::Schema()->Fetch(false, $where, $orderBy, null, 0, null, $join, JoinType::Inner(), $joinCondition);
 }