'dependent' => true,
'conditions' => '',
'fields' => array(
+ 'CharactersHasProfile.id',
'CharactersHasProfile.character_id',
'CharactersHasProfile.profile_table_id',
'CharactersHasProfile.value',
}
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));