Class OnpubSAMaps

Description

Manage section-article maps in an Onpub database.

This class contains the methods to manage the data contained in an OnpubSAMaps table. An OnpubSAMaps table maps section IDs to article IDs. This allows Onpub to do the following without any duplication of section/article data:

  • Add a single article to multiple sections.
  • Add multiple articles to a single section.
  • Specify the order of articles in a section.

Located in /OnpubSAMaps.php (line 21)


	
			
Variable Summary
Method Summary
OnpubSAMaps __construct (PDO $pdo, [bool $enableTransactions = TRUE])
int delete (int $sectionID, int $articleID)
int getID (OnpubSAMap $samap)
mixed insert (mixed $samaps)
array select ([OnpubQueryOptions $queryOptions = NULL], [ $sectionID = NULL], [ $articleID = NULL])
int update (OnpubSAMap $samap)
Variables
bool $enableTransactions (line 27)
  • access: public
Methods
Constructor __construct (line 50)

Connect to an Onpub database.

All the methods in this class which query the database use the database connection provided by the PDO object required by this constructor. Currently, Onpub only supports MySQL as a database for storing content. Therefore, when constructing the PDO object, only the PDO_MYSQL driver is supported as a PDO data source.

All the methods in this class require the Onpub schema to be installed in the PDO-connected database. The OnpubDatabase class contains methods to manage the Onpub schema. The Onpub schema can also be installed by clicking the "Install the schema" link once logged in to the Onpub web interface. The schema generally only has to be installed once per database.

OnpubSAMaps __construct (PDO $pdo, [bool $enableTransactions = TRUE])
delete (line 62)
  • return: The number of maps deleted, 0 if no maps were deleted.
  • access: public
int delete (int $sectionID, int $articleID)
  • int $sectionID: Delete the map(s) with sectionID.
  • int $articleID: Delete the map(s) with articleID.
getID (line 93)
  • return: The ID of the map. NULL if the map does not exist in the database.
  • access: public
int getID (OnpubSAMap $samap)
  • OnpubSAMap $samap: Map whose ID you want to get.
insert (line 201)
  • return: The ID(s) of the new map(s). An int will be returned if a single map was inserted. An array of ints will be returned if multiple maps were inserted.
  • throws: PDOException if there's a database error.
  • access: public
mixed insert (mixed $samaps)
  • mixed $samaps: A single OnpubSAMap object or an array of OnpubSAMap objects (to insert multiple maps at a time).
select (line 117)
  • return: An array of OnpubSAMap objects.
  • access: public
array select ([OnpubQueryOptions $queryOptions = NULL], [ $sectionID = NULL], [ $articleID = NULL])
update (line 271)
  • return: 1 if the map was updated. 0 if the map does not exist in the database.
  • access: public
int update (OnpubSAMap $samap)

Documentation generated on Fri, 08 Feb 2013 04:02:22 -0500 by phpDocumentor 1.4.4