Bonjour !
J'ai une table 'spip_vu_publications' ainsi qu'une table auxiliaire 'spip_mots_vu_publications". Elles ont toutes les deux le champ 'id_publication' en commun... mais la jointure ne se fait automatiquement.
Notamment, la boucle <BOUCLE_p(VU_PUBLICATIONS){id_mot}> me retourne une belle erreur : « Erreur SQL : Unknown column 'id_mot' in 'where clause' ».
Alors que si je force, la boucle <BOUCLE_p(VU_PUBLICATIONS mots_vu_publications){mots_vu_publications.id_mot}> fonctionne bien.
Ça devrait pourtant fonctionner automatiquement... je me trompe ? Ou est mon erreur ?
Ci joint, une copie des déclarations de tables.
Merci d'avance pour les quelques pistes que vous m'indiquerez !
Jonathan.
----
TABLE PRINCIPALE
function vu_declarer_tables_principales($tables_principales){
// Table 'spip_vu_publications'
$publications = array(
"id_publication" => "bigint(21) NOT NULL auto_increment",
"titre" => "text NOT NULL",
"lien" => "text NOT NULL",
"auteur" => "text NOT NULL",
"date" => "datetime NOT NULL",
"statut" => "varchar(10) NOT NULL",
);
$publications_key = array(
"PRIMARY KEY" => "id_publication"
);
$publications_join = array(
"id_publication" => "id_publication"
);
$tables_principales['spip_vu_publications'] = array(
'field' => &$publications,
'key' => &$publications_key,
'join' => &$publications_join
);
return $tables_principales;
}
TABLE AUXILIAIRE
function vu_declarer_tables_auxiliaires($tables_auxiliaires){
$publications_mots = array(
"id_mot" => "BIGINT(21) NOT NULL",
"id_publication" => "BIGINT(21) NOT NULL"
);
$publications_mots_key = array(
"PRIMARY KEY" => "id_mot, id_publication",
);
$tables_auxiliaires['spip_mots_vu_publications'] = array(
'field' => &$publications_mots,
'key' => &$publications_mots_key
);
return $tables_auxiliaires;
}