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

Changeset 11249


Ignore:
Timestamp:
Apr 9, 2009, 3:55:18 AM (13 years ago)
Author:
ebihara
Message:

#3765:imported some methods impremented on Peer classes to the Table classes

Location:
OpenPNE3/branches/goto_doctrine/lib/model/doctrine
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/AdminUserTable.class.php

    r11208 r11249  
    11<?php
     2
    23/**
    3  * This class has been auto-generated by the Doctrine ORM Framework
     4 * This file is part of the OpenPNE package.
     5 * (c) OpenPNE Project (http://www.openpne.jp/)
     6 *
     7 * For the full copyright and license information, please view the LICENSE
     8 * file and the NOTICE file that were distributed with this source code.
    49 */
     10
    511class AdminUserTable extends Doctrine_Table
    612{
     13  public function retrieveByUsername($username)
     14  {
     15    return $this->createQuery()
     16      ->where('username = ?', $username)
     17      ->fetchOne();
     18  }
    719
     20  public function retrievesAll()
     21  {
     22    return $this->createQuery()->execute();
     23  }
    824}
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/BlacklistTable.class.php

    r11208 r11249  
    11<?php
     2
    23/**
    3  * This class has been auto-generated by the Doctrine ORM Framework
     4 * This file is part of the OpenPNE package.
     5 * (c) OpenPNE Project (http://www.openpne.jp/)
     6 *
     7 * For the full copyright and license information, please view the LICENSE
     8 * file and the NOTICE file that were distributed with this source code.
    49 */
     10
    511class BlacklistTable extends Doctrine_Table
    612{
    7 
     13  public function retrieveByUid($mobileUid)
     14  {
     15    return $this->createQuery()
     16      ->where('uid = ?', $mobileUid)
     17      ->fetchOne();
     18  }
    819}
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/CommunityCategoryTable.class.php

    r11208 r11249  
    11<?php
     2
    23/**
    3  * This class has been auto-generated by the Doctrine ORM Framework
     4 * This file is part of the OpenPNE package.
     5 * (c) OpenPNE Project (http://www.openpne.jp/)
     6 *
     7 * For the full copyright and license information, please view the LICENSE
     8 * file and the NOTICE file that were distributed with this source code.
    49 */
     10
    511class CommunityCategoryTable extends Doctrine_Table
    612{
     13  public function retrieveAll()
     14  {
     15    return $this->createQuery()->execute();
     16  }
    717
     18  public function retrieveAllRoots()
     19  {
     20    return $this->createQuery()
     21      ->where('left_col = 1')
     22      ->execute();
     23  }
     24
     25  public function retrieveAllChildren()
     26  {
     27    return $this->createQuery()
     28      ->where('left_col > 1')
     29      ->execute();
     30  }
    831}
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/CommunityConfigTable.class.php

    r11208 r11249  
    11<?php
     2
    23/**
    3  * This class has been auto-generated by the Doctrine ORM Framework
     4 * This file is part of the OpenPNE package.
     5 * (c) OpenPNE Project (http://www.openpne.jp/)
     6 *
     7 * For the full copyright and license information, please view the LICENSE
     8 * file and the NOTICE file that were distributed with this source code.
    49 */
     10
    511class CommunityConfigTable extends Doctrine_Table
    612{
     13  public function retrievesByCommunityId($communityId)
     14  {
     15    return $this->createQuery()
     16      ->where('community_id = ?', $communityId)
     17      ->execute();
     18  }
    719
     20  public function retrieveByNameAndCommunityId($name, $communityId)
     21  {
     22    return $this->createQuery()
     23      ->where('name = ?', $name)
     24      ->andWhere('community_id = ?', $communityId)
     25      ->fetchOne();
     26  }
    827}
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/FileBinTable.class.php

    r11208 r11249  
    11<?php
     2
    23/**
    3  * This class has been auto-generated by the Doctrine ORM Framework
     4 * This file is part of the OpenPNE package.
     5 * (c) OpenPNE Project (http://www.openpne.jp/)
     6 *
     7 * For the full copyright and license information, please view the LICENSE
     8 * file and the NOTICE file that were distributed with this source code.
    49 */
     10
    511class FileBinTable extends Doctrine_Table
    612{
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/FileTable.class.php

    r11208 r11249  
    11<?php
     2
    23/**
    3  * This class has been auto-generated by the Doctrine ORM Framework
     4 * This file is part of the OpenPNE package.
     5 * (c) OpenPNE Project (http://www.openpne.jp/)
     6 *
     7 * For the full copyright and license information, please view the LICENSE
     8 * file and the NOTICE file that were distributed with this source code.
    49 */
     10
    511class FileTable extends Doctrine_Table
    612{
    7 
     13  public function retrieveByFilename($filename)
     14  {
     15    return $this->createQuery()
     16      ->where('name = ?', $filename)
     17      ->fetchOne();
     18  }
    819}
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/GadgetConfigTable.class.php

    r11208 r11249  
    11<?php
     2
    23/**
    3  * This class has been auto-generated by the Doctrine ORM Framework
     4 * This file is part of the OpenPNE package.
     5 * (c) OpenPNE Project (http://www.openpne.jp/)
     6 *
     7 * For the full copyright and license information, please view the LICENSE
     8 * file and the NOTICE file that were distributed with this source code.
    49 */
     10
    511class GadgetConfigTable extends Doctrine_Table
    612{
     13  protected $results;
    714
     15  public function retrieveByGadgetIdAndName($gadgetId, $name)
     16  {
     17    $results = $this->getResults();
     18
     19    return (isset($results[$gadgetId][$name])) ? $results[$gadgetId][$name] : null;
     20  }
     21
     22  protected function getResults()
     23  {
     24    if (is_null($this->results))
     25    {
     26      $this->results = array();
     27      $objects = $this->createQuery()->execute();
     28      foreach ($objects as $object)
     29      {
     30        $this->results[$object->gadgetId][$object->name] = $object;
     31      }
     32    }
     33
     34    return $this->results;
     35  }
    836}
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/MemberImageTable.class.php

    r11208 r11249  
    11<?php
     2
    23/**
    3  * This class has been auto-generated by the Doctrine ORM Framework
     4 * This file is part of the OpenPNE package.
     5 * (c) OpenPNE Project (http://www.openpne.jp/)
     6 *
     7 * For the full copyright and license information, please view the LICENSE
     8 * file and the NOTICE file that were distributed with this source code.
    49 */
     10
    511class MemberImageTable extends Doctrine_Table
    612{
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/MemberProfileTable.class.php

    r11219 r11249  
    1111class MemberProfileTable extends Doctrine_Table
    1212{
    13 
     13  public function getProfileListByMemberId($memberId)
     14  {
     15    return array();
     16
     17    $profiles = array();
     18
     19    $c = new Criteria();
     20
     21    parent::addSelectColumns($c);
     22
     23    $c->addSelectColumn(ProfilePeer::NAME);
     24    $c->addSelectColumn(ProfileI18nPeer::CAPTION);
     25
     26    $c->add(self::MEMBER_ID, $memberId);
     27    $c->add(self::LFT_KEY, 1);
     28    $c->add(ProfileI18nPeer::CULTURE, sfPropel::getDefaultCulture());
     29    $c->addJoin(ProfilePeer::ID, ProfileI18nPeer::ID);
     30    $c->addJoin(ProfilePeer::ID, MemberProfilePeer::PROFILE_ID);
     31
     32    $c->addAscendingOrderByColumn(ProfilePeer::SORT_ORDER);
     33
     34    $stmt = self::doSelectStmt($c);
     35    while ($row = $stmt->fetch(PDO::FETCH_NUM))
     36    {
     37      $obj = new MemberProfile();
     38      $obj->hydrateProfiles($row);
     39      $profiles[] = $obj;
     40    }
     41
     42    return $profiles;
     43  }
     44
     45  public function getViewableProfileListByMemberId($memberId, $myMemberId = null)
     46  {
     47    return array();
     48
     49    if(is_null($myMemberId))
     50    {
     51      $myMemberId = sfContext::getInstance()->getUser()->getMemberId();
     52    }
     53
     54    $profiles = self::getProfileListByMemberId($memberId);
     55    foreach ($profiles as $key => $profile)
     56    {
     57      if (!$profile->isViewable($myMemberId))
     58      {
     59        unset($profiles[$key]);
     60      }
     61    }
     62
     63    return $profiles;
     64  }
     65
     66  public function retrieveByMemberIdAndProfileId($memberId, $profileId)
     67  {
     68    return null;
     69
     70    $c = new Criteria();
     71    $c->add(self::MEMBER_ID, $memberId);
     72    $c->add(self::PROFILE_ID, $profileId);
     73
     74    $result = self::doSelectOne($c);
     75    return $result;
     76  }
     77
     78  public function retrieveByMemberIdAndProfileName($memberId, $profileName)
     79  {
     80    return null;
     81
     82    $c = new Criteria();
     83    $c->add(ProfilePeer::NAME, $profileName);
     84    $c->add(MemberProfilePeer::MEMBER_ID, $memberId);
     85    $c->addJoin(MemberProfilePeer::PROFILE_ID, ProfilePeer::ID);
     86    return MemberProfilePeer::doSelectOne($c);
     87  }
     88
     89  public function searchMemberIds($profile = array(), $ids = array())
     90  {
     91    return array();
     92
     93    foreach ($profile as $key => $value)
     94    {
     95      $item = ProfilePeer::retrieveByName($key);
     96      $_result = array();
     97      $column = self::VALUE;
     98      if ($item->getFormType() === 'date')
     99      {
     100        $options = $item->getProfileOptions();
     101        foreach ($value as $k => $v)
     102        {
     103          $option = array_shift($options);
     104          if ($v)
     105          {
     106            $ids = self::filterMemberIdByProfileOption($ids, $column, $v, $option, array());
     107          }
     108        }
     109        continue;
     110      }
     111      elseif (is_array($value))
     112      {
     113        $column = self::PROFILE_OPTION_ID;
     114      }
     115
     116      $ids = self::filterMemberIdByProfile($ids, $column, $value, $item, array());
     117    }
     118
     119    return $ids;
     120  }
     121
     122  public function filterMemberIdByProfile($ids, $column, $value, Profile $item, $choices)
     123  {
     124    return array();
     125
     126    $_result = array();
     127
     128    $c = opFormItemGenerator::filterSearchCriteria(null, $column, $value, $item->toArray(), array());
     129    $c->clearSelectColumns()->addSelectColumn(self::MEMBER_ID);
     130    $c->setIgnoreCase(false);
     131    $c->add(self::PROFILE_ID, $item->getId());
     132    $stmt = self::doSelectStmt($c);
     133    while ($raw = $stmt->fetch(PDO::FETCH_NUM))
     134    {
     135      $_result[] = $raw[0];
     136    }
     137
     138    if (is_array($ids))
     139    {
     140      $ids = array_values(array_intersect($ids, $_result));
     141    }
     142    else
     143    {
     144      $ids = array_values($_result);
     145    }
     146
     147    return $ids;
     148  }
     149
     150  public function filterMemberIdByProfileOption($ids, $column, $value, ProfileOption $item, $choices)
     151  {
     152    return array();
     153
     154    $_result = array();
     155    $c = new Criteria();
     156    $c->add($column, $value);
     157    $c->clearSelectColumns()->addSelectColumn(self::MEMBER_ID);
     158    $c->setIgnoreCase(false);
     159    $c->add(self::PROFILE_OPTION_ID, $item->getId());
     160    $stmt = self::doSelectStmt($c);
     161    while ($raw = $stmt->fetch(PDO::FETCH_NUM))
     162    {
     163      $_result[] = $raw[0];
     164    }
     165
     166    if (is_array($ids))
     167    {
     168      $ids = array_values(array_intersect($ids, $_result));
     169    }
     170    else
     171    {
     172      $ids = array_values($_result);
     173    }
     174
     175    return $ids;
     176  }
     177
     178  public function makeRoot($memberId, $profileId)
     179  {
     180    return null;
     181
     182    $root = new MemberProfile();
     183    $root->makeRoot();
     184    $root->setMemberId($memberId);
     185    $root->setProfileId($profileId);
     186    $root->save();
     187
     188    $root->setScopeIdValue($root->getId());
     189    $root->save();
     190
     191    return $root;
     192  }
     193
     194  public function createChild(MemberProfile $parent, $memberId, $profileId, $optionIds, $values = array())
     195  {
     196    return null;
     197
     198    foreach ($optionIds as $i => $optionId)
     199    {
     200      $childProfile = new MemberProfile();
     201      $childProfile->setMemberId($memberId);
     202      $childProfile->setProfileId($profileId);
     203      $childProfile->setProfileOptionId($optionId);
     204      $childProfile->insertAsLastChildOf($parent);
     205      if (isset($values[$i]))
     206      {
     207        $childProfile->setValue($values[$i]);
     208      }
     209      $childProfile->save();
     210    }
     211  }
    14212}
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/MemberTable.class.php

    r11219 r11249  
    11<?php
     2
    23/**
    3  * This class has been auto-generated by the Doctrine ORM Framework
     4 * This file is part of the OpenPNE package.
     5 * (c) OpenPNE Project (http://www.openpne.jp/)
     6 *
     7 * For the full copyright and license information, please view the LICENSE
     8 * file and the NOTICE file that were distributed with this source code.
    49 */
     10
    511class MemberTable extends Doctrine_Table
    612{
     
    1319    return $member;
    1420  }
     21
     22  public function searchMemberIds($member = array(), $ids = null)
     23  {
     24    // the searchable field of the member table is only "name"
     25    if (!empty($member['name']))
     26    {
     27      $_result = $this->createQuery()
     28        ->select('id')
     29        ->where('name LIKE %?%', $member['name'])
     30        ->fetchArray();
     31
     32      if (is_array($ids))
     33      {
     34        $ids = array_values(array_intersect($ids, $_result));
     35      }
     36      else
     37      {
     38        $ids = array_values($_result);
     39      }
     40    }
     41
     42    return $ids;
     43  }
     44
     45  public function retrivesByInviteMemberId($memberId)
     46  {
     47//    opActivateBehavior::disable();
     48
     49    $members = $this->createQuery()
     50      ->where('invite_member_id = ?', $memberId)
     51      ->andWhere('is_active = ?', false)
     52      ->execute();
     53
     54//    opActivateBehavior::enable();
     55
     56    return $members;
     57  }
    1558}
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/ProfileOptionTable.class.php

    r11208 r11249  
    11<?php
     2
    23/**
    3  * This class has been auto-generated by the Doctrine ORM Framework
     4 * This file is part of the OpenPNE package.
     5 * (c) OpenPNE Project (http://www.openpne.jp/)
     6 *
     7 * For the full copyright and license information, please view the LICENSE
     8 * file and the NOTICE file that were distributed with this source code.
    49 */
     10
    511class ProfileOptionTable extends Doctrine_Table
    612{
     13  public function retrieveByProfileId($profileId)
     14  {
     15    return $this->createQuery()
     16      ->where('profile_id = ?', $profileId)
     17      ->orderBy('sort_order')
     18      ->execute();
     19  }
    720
     21  public function getMaxSortOrder()
     22  {
     23    $result = $this->createQuery()
     24      ->orderBy('sort_order DESC')
     25      ->fetchOne();
     26
     27    if ($result)
     28    {
     29      return (int)$result->sortOrder;
     30    }
     31
     32    return 0;
     33  }
    834}
  • OpenPNE3/branches/goto_doctrine/lib/model/doctrine/ProfileTable.class.php

    r11208 r11249  
    11<?php
     2
    23/**
    3  * This class has been auto-generated by the Doctrine ORM Framework
     4 * This file is part of the OpenPNE package.
     5 * (c) OpenPNE Project (http://www.openpne.jp/)
     6 *
     7 * For the full copyright and license information, please view the LICENSE
     8 * file and the NOTICE file that were distributed with this source code.
    49 */
     10
    511class ProfileTable extends Doctrine_Table
    612{
     13  const PUBLIC_FLAG_SNS = 1;
     14  const PUBLIC_FLAG_FRIEND = 2;
     15  const PUBLIC_FLAG_PRIVATE = 3;
    716
     17  protected $publicFlags = array(
     18    self::PUBLIC_FLAG_SNS     => 'All Members',
     19    self::PUBLIC_FLAG_FRIEND  => 'My Friends',
     20    self::PUBLIC_FLAG_PRIVATE => 'Private',
     21  );
     22
     23  public function getPublicFlags()
     24  {
     25    return array_map(array(sfContext::getInstance()->getI18N(), '__'), $this->publicFlags);
     26  }
     27
     28  public function getPublicFlag($flag)
     29  {
     30    return sfContext::getInstance()->getI18N()->__($this->publicFlags[$flag]);
     31  }
     32
     33  public function retrievesAll()
     34  {
     35    return $this->createQuery()->orderBy('sort_order')->execute();
     36  }
     37
     38  public function retrieveByIsDispRegist()
     39  {
     40    return $this->createQuery()
     41      ->where('is_disp_regist = ?', true)
     42      ->orderBy('sort_order')
     43      ->execute();
     44  }
     45
     46  public function retrieveByIsDispConfig()
     47  {
     48    return $this->createQuery()
     49      ->where('is_disp_config = ?', true)
     50      ->orderBy('sort_order')
     51      ->execute();
     52  }
     53
     54  public function retrieveByIsDispSearch()
     55  {
     56    return $this->createQuery()
     57      ->where('is_disp_search = ?', true)
     58      ->orderBy('sort_order')
     59      ->execute();
     60  }
     61
     62  public function retrieveByName($name)
     63  {
     64    return $this->createQuery()
     65      ->where('name = ?', $name)
     66      ->fetchOne();
     67  }
     68
     69  public function getMaxSortOrder()
     70  {
     71    $result = $this->createQuery()
     72      ->orderBy('sort_order DESC')
     73      ->fetchOne();
     74
     75    if ($result)
     76    {
     77      return (int)$result->sortOrder;
     78    }
     79
     80    return 0;
     81  }
    882}
Note: See TracChangeset for help on using the changeset viewer.