我有一个包含不同语言描述的项目,我想打印属于每种语言元素的描述
这是我的数据库:
描述
-id
-title
-description
-language_id
-multimedia_id
语言
-id
-language多媒体
-id
-description_id
-web_file
-original_file
-category_id
-created
-created_by
-multimedia_type_id
关系
language_id - > id(语言)multimedia_id - > ID(多媒体)
如果我这样说:
$('//text here').mouseleave(function(){
slideShowInterval = setInterval(changePosition, speed);
});
它只会在description_id(多媒体)和id(描述)中打印具有相同ID的描述
我想在multimedia_id(描述)和id(多媒体)中打印具有相同ID的描述
更新
我的MultimediaTable
<? $this->Text->autoParagraph(h($multimedia->description->description)); ?>
更新2
MultimediaController
public function initialize(array $config)
{
$this->table('multimedia');
$this->displayField('title');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
$this->belongsTo('Descriptions', [
'foreignKey' => 'description_id',
'joinType' => 'INNER'
]);
$this->belongsTo('Languages', [
'foreignKey' => 'language_id',
'joinType' => 'INNER'
]);
$this->belongsTo('Categories', [
'foreignKey' => 'category_id',
'joinType' => 'INNER'
]);
$this->belongsTo('Users', [
'foreignKey' => 'created_by',
'joinType' => 'INNER'
]);
$this->belongsTo('Countries', [
'foreignKey' => 'country_id',
'joinType' => 'INNER'
]);
$this->belongsTo('MultimediaTypes', [
'foreignKey' => 'multimedia_type_id',
'joinType' => 'INNER'
]);
}
public function buildRules(RulesChecker $rules)
{
$rules->add($rules->existsIn(['language_id'], 'Languages'));
$rules->add($rules->existsIn(['category_id'], 'Categories'));
$rules->add($rules->existsIn(['created_by'], 'Users'));
$rules->add($rules->existsIn(['country_id'], 'Countries'));
$rules->add($rules->existsIn(['multimedia_type_id'], 'MultimediaTypes'));
$rules->add($rules->existsIn(['description_id'], 'Descriptions'));
return $rules;
}