* @author Louis Lapointe * @link http://pmo.developpez.com/ * @since PhpMyObject v0.1 * @version $Revision: $ * @copyright Copyright (C) 2007-2008 Nicolas Boiteux * @copyright Copyright (C) 2008 Louis Lapointe * @license GPLv3 {@link http://www.gnu.org/licenses/gpl} * @filesource * */ /** * This interface defines the methods a class must implement * to provide a working PMO map class. * * PMO_Map is a array of PMO_Objects. * Each row of array contains as many PMO_Objects * as there is table concerns by the SQL Request * * @package PhpMyObject * @subpackage PMO_Core * @see PMO_MyMap */ interface PMO_Map{ /** * Add an array of PMO_Object to map * tablename=>PMO_Object * * @return void */ public function add(array $row); /** * build a new map from an other map * this new map only contains row that are relative to the object * * @return PMO_Map * @throws Exception */ public function getMapByObject(PMO_Object $object); /** * build a new map from a map that contains * row relative to the object. This function * use the values of the primary keys to retrieve * the lines concerned. * * Others value can stay NULL * * @return PMO_Map * @throws Exception */ public function getMapByObjectByValue(PMO_Object $object); /** * Alias of getMapByObject */ public function getMapLinked(PMO_Object $object); /** * build a new map that only contains objects of type tablename * relative to our object. * * @return PMO_Map * @throws Exception */ public function getMapRelated(PMO_Object $object, $tablename); /** * build a new map that only contains objects of type tablename with attribute=value. * Search is done only on one fields. Faster than getMapByObjectByValue but less powerfull. * * @return PMO_Map * @throws Exception */ public function getMapByValue($tablename, $attribute, $value); /** * build a new map that only contains objects of type tablename * * @return PMO_Map * @throws Exception */ public function getMapByTable($tablename); /** * return one row of the array structure * Null is returned at the end * The array is not pop, it's only a cursor * that move on index and return the results. * * @return array */ public function fetch(); /** * returns one PMO_Object of row of the current map array structure * * Null is returned at the end and the iterator is reset. * * The array is not poped, it's only a cursor that move * an index and return the results. * * @return PMO_Object */ public function fetchTable($tablename); /** * Return number of rows for this PMO_Map */ public function count(); /** * retrieve first object in map matching with tablename, and attribute=>value * If object is not find return an exception * * @throws Exception * @return PMO_Map */ public function getObjectByValue($tablename, $attribute, $value); /** * retrieve one object in map comparing the value of primary key of object in param * All primary keys must be set, it's more powerfull than getObjectByValue * but slower too. If object is not find, return an exception * * @throws Exception * @return PMO_Object */ public function getObjectByObject(PMO_Object $object); } ?>