declarer_tables_objets_surnoms

This pipeline creates a relationship between an object type and its corresponding SQL table. By default, an ’s’ is added to the end of the object type name (e.g. the ’article’ object maps to a table called ’articles’).

Pipeline call:

$surnoms = pipeline('declarer_tables_objets_surnoms',
	array(
		'article' => 'articles',
		'auteur' => 'auteurs',
		//...
	));

These relationships enable the functions table_objet() and objet_type() to work together:

// type...
$type = objet_type('spip_articles'); // article
$type = objet_type('articles'); // article
// table...
$objet = table_objet('article'); // articles
$table = table_objet_sql('article'); // spip_articles
// id...
$_id_objet = id_table_objet('articles'); // id_article
$_id_objet = id_table_objet('spip_articles'); // id_article
$_id_objet = id_table_objet('article'); // id_article

Example

The "jeux" plugin uses:

function jeux_declarer_tables_objets_surnoms($surnoms) {
	$surnoms['jeu'] = 'jeux';
	return $surnoms;
}

Author Gilles Vincent Published : Updated : 12/03/23

Translations : English, français