OSDN Git Service

CharactersHasProfilesのCharacterTableで、table_id一覧の取得方法変更(DBアクセスなし)
authorCake <cake_67@users.sourceforge.jp>
Sat, 24 Apr 2010 13:01:16 +0000 (22:01 +0900)
committerCake <cake_67@users.sourceforge.jp>
Sat, 24 Apr 2010 13:02:14 +0000 (22:02 +0900)
app/models/profile.php
app/views/helpers/profiledisp.php

index db13515..32617be 100644 (file)
@@ -118,6 +118,7 @@ class Profile extends AppModel {
                        'dependent' => true,
                        'conditions' => '',
                        'fields' => array(
+                               'CharactersHasProfile.id',
                                'CharactersHasProfile.character_id',
                                'CharactersHasProfile.profile_table_id',
                                'CharactersHasProfile.value',
index 092a57d..1289613 100644 (file)
@@ -352,15 +352,8 @@ class ProfiledispHelper extends Helper {
                        }
 
                        if (!CorePlus::is_valid($v, 'profile_table_id')) {
-                               if (!isset($ProfileTable)) {
-                                       App::import('Model', 'ProfileTable');
-                                       $ProfileTable = new ProfileTable;
-                               }
-                               $prof_table_ids = $ProfileTable->find('list', array(
-                                       'ProfileTable.profile_id' => $profile_id,
-                                       'fields' => array('ProfileTable.id'),
-                                       'order' => 'ProfileTable.sort_order'
-                               ));
+                               $profile_table_ids = array_keys(Set::combine($characters_has_profile, '{n}.profile_table_id'));
+
 
                                if (!empty($prof_table_ids)) {
                                        $v['profile_table_id'] = current(array_slice($prof_table_ids, $profile_num+1, 1));