Coding with SPIP 2.1
SPIP 2.1 Technical Documentation

> > > > declarer_tables_objets_surnoms

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:

  1. $surnoms = pipeline('declarer_tables_objets_surnoms',
  2. 'article' => 'articles',
  3. 'auteur' => 'auteurs',
  4. //...
  5. ));

Download

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

  1. // type...
  2. $type = objet_type('spip_articles'); // article
  3. $type = objet_type('articles'); // article
  4. // table...
  5. $objet = table_objet('article'); // articles
  6. $table = table_objet_sql('article'); // spip_articles
  7. // id...
  8. $_id_objet = id_table_objet('articles'); // id_article
  9. $_id_objet = id_table_objet('spip_articles'); // id_article
  10. $_id_objet = id_table_objet('article'); // id_article

Download

Example

The "jeux" plugin uses:

  1. function jeux_declarer_tables_objets_surnoms($surnoms) {
  2. $surnoms['jeu'] = 'jeux';
  3. return $surnoms;
  4. }

Download