ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 11338


Ignore:
Timestamp:
Apr 17, 2009, 4:22:35 AM (13 years ago)
Author:
ebihara
Message:

#3765:fixed some models to work CommunityMember? and Friend correctly

Location:
OpenPNE3/branches/goto_doctrine
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/branches/goto_doctrine/apps/pc_frontend/modules/community/templates/memberManageSuccess.php

    r11029 r11338  
    44<li>
    55<?php echo link_to($member->getName(), 'member/profile?id='.$member->getId()); ?>
    6 <?php $communityMembers = $member->getCommunityMembers(); ?>
     6<?php $communityMembers = $member->getCommunityMember(); ?>
    77<?php if ($communityMembers[0]->getPosition() !== 'admin') : ?>
    88&nbsp;
  • OpenPNE3/branches/goto_doctrine/lib/action/sfOpenPNECommunityAction.class.php

    r11250 r11338  
    105105    }
    106106
    107     $this->pager = CommunityPeer::getJoinCommunityListPager($memberId, $request->getParameter('page', 1), $this->size);
     107    $this->pager = Doctrine::getTable('Community')->getJoinCommunityListPager($memberId, $request->getParameter('page', 1), $this->size);
    108108
    109109    if (!$this->pager->getNbResults())
     
    131131      $this->size = 20;
    132132    }
    133     $this->pager = CommunityPeer::getCommunityMemberListPager($this->id, $request->getParameter('page', 1), $this->size);
     133    $this->pager = Doctrine::getTable('Community')->getCommunityMemberListPager($this->id, $request->getParameter('page', 1), $this->size);
    134134
    135135    if (!$this->pager->getNbResults()) {
     
    225225
    226226    $this->community = Doctrine::getTable('Community')->find($this->id);
    227     $this->pager = CommunityPeer::getCommunityMemberListPager($this->id, $request->getParameter('page', 1));
     227    $this->pager = Doctrine::getTable('Community')->getCommunityMemberListPager($this->id, $request->getParameter('page', 1));
    228228
    229229    if (!$this->pager->getNbResults())
  • OpenPNE3/branches/goto_doctrine/lib/action/sfOpenPNEFriendAction.class.php

    r11219 r11338  
    4646    $this->pager = Doctrine::getTable('MemberRelationship')->getFriendListPager($this->id, $request->getParameter('page', 1), $this->size);
    4747
    48     if (!$this->pager->getNbResults()) {
     48    if (!$this->pager->getNbResults())
     49    {
    4950      return sfView::ERROR;
    5051    }
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/CommunityTable.class.php

    r11263 r11338  
    3333  public function getJoinCommunityListPager($memberId, $page = 1, $size = 20)
    3434  {
    35     $c = new Criteria();
    36     $c->add(CommunityMemberPeer::MEMBER_ID, $memberId);
    37     $c->add(CommunityMemberPeer::POSITION, 'pre', Criteria::NOT_EQUAL);
    38     $c->addJoin(self::ID, CommunityMemberPeer::COMMUNITY_ID);
     35    $q = Doctrine::getTable('Community')->createQuery()
     36      ->where('cm.position <> ?', 'pre')
     37      ->leftJoin('Community.CommunityMember cm');
    3938
    40     $pager = new sfPropelPager('Community', $size);
    41     $pager->setCriteria($c);
     39    $pager = new sfDoctrinePager('Community', $size);
     40    $pager->setQuery($q);
    4241    $pager->setPage($page);
    4342    $pager->init();
     
    4847  public function getCommunityMemberListPager($communityId, $page = 1, $size = 20)
    4948  {
    50     $c = new Criteria();
    51     $c->add(CommunityMemberPeer::COMMUNITY_ID, $communityId);
    52     $c->add(CommunityMemberPeer::POSITION, 'pre', Criteria::NOT_EQUAL);
    53     $c->addJoin(MemberPeer::ID, CommunityMemberPeer::MEMBER_ID);
     49    $q = Doctrine::getTable('Member')->createQuery()
     50      ->where('cm.position <> ?', 'pre')
     51      ->leftJoin('Member.CommunityMember cm');
    5452
    55     $pager = new sfPropelPager('Member', $size);
    56     $pager->setCriteria($c);
     53    $pager = new sfDoctrinePager('Member', $size);
     54    $pager->setQuery($q);
    5755    $pager->setPage($page);
    5856    $pager->init();
     
    6563    $result = array();
    6664
    67     $c = new Criteria();
    68     $c->clearSelectColumns()->addSelectColumn(self::ID);
    69     $c->add(CommunityMemberPeer::MEMBER_ID, $memberId);
    70     $c->add(CommunityMemberPeer::POSITION, 'pre', Criteria::NOT_EQUAL);
    71     $c->addJoin(self::ID, CommunityMemberPeer::COMMUNITY_ID);
    72     $stmt = self::doSelectStmt($c);
     65    $resultSet = $this->createQuery()
     66      ->select('id')
     67      ->where('cm.member_id = ?', $memberId)
     68      ->andWhere('cm.position <> ?', 'pre')
     69      ->leftJoin('Community.CommunityMember cm')
     70      ->execute();
    7371
    74     while ($row = $stmt->fetch(PDO::FETCH_NUM))
     72    foreach ($resultSet as $value)
    7573    {
    76       $result[] = $row[0];
     74      $result[] = $value->getId();
    7775    }
    7876
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/MemberRelationshipTable.class.php

    r11219 r11338  
    2828  public function getFriendListPager($memberId, $page = 1, $size = 20)
    2929  {
    30   /*
    31     $c = new Criteria();
    32     $c->add(self::MEMBER_ID_TO, $memberId);
    33     $c->add(self::IS_FRIEND, true);
    34     $c->addJoin(MemberPeer::ID, self::MEMBER_ID_FROM);
     30    $q = Doctrine::getTable('Member')->createQuery()
     31      ->where('mr.member_id_to = ?', $memberId)
     32      ->andWhere('mr.is_friend = ?', true)
     33      ->leftJoin('Member.MemberRelationship mr ON mr.member_id_from = Member.id');
    3534
    36     $pager = new sfPropelPager('Member', $size);
    37     $pager->setCriteria($c);
     35    $pager = new sfDoctrinePager('Member', $size);
     36    $pager->setQuery($q);
    3837    $pager->setPage($page);
    3938    $pager->init();
    4039
    4140    return $pager;
    42     */
    43     return null;
    4441  }
    4542
Note: See TracChangeset for help on using the changeset viewer.