Explicit join declarations

The links between tables are declared within SPIP in the ecrire/public/interfaces.php file. Further declarations can be added with the "declarer_tables_interfaces" pipeline. Such a declaration might look like:
// suggest a join between sections and documents
$tables_jointures['spip_rubriques'][]= 'documents_liens';
// suggest a join between articles and authors, specifying the join field explicitly
$tables_jointures['spip_articles']['id_auteur']= 'auteurs_articles';
This shows the links that are possible between tables, When 2 tables can have several fields to link between them, the example above shows how to specify the linking field precisely. {{{Exceptions}}} It is even possible to create joins by calling non-existent fields, as demonstrated by the sample criterion {titre_mot=yy}, which can lead to a join on the "spip_mots" table, even though the "titre_mot" SQL field does not exist in that table. This is done as shown below:
$exceptions_des_jointures['titre_mot'] = array('spip_mots', 'titre');

Author Mark Baber Published : Updated : 12/05/17

Translations : English, français, Nederlands