PhpMyObject
[ class tree: PhpMyObject ] [ index: PhpMyObject ] [ all elements ]

Source for file PMO_Map.php

Documentation is available at PMO_Map.php

  1. <?php
  2. /**
  3.  * This file contains the PMO_Map interface.
  4.  *
  5.  * This file is part of the PhpMyObject project,
  6.  * an Object-Relational Mapping (ORM) system.
  7.  * 
  8.  * For questions, help, comments, discussion, etc., please join our
  9.  * forum at {@link http://www.developpez.net/forums/forumdisplay.php?f=770}
  10.  * or our mailing list at {@link http://groups.google.com/group/pmo-dev}.
  11.  *
  12.  * PhpMyObject is free software: you can redistribute it and/or modify
  13.  * it under the terms of the GNU General Public License as published by
  14.  * the Free Software Foundation, either version 3 of the License, or
  15.  * (at your option) any later version.
  16.  *
  17.  * This program is distributed in the hope that it will be useful,
  18.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
  20.  * GNU General Public License for more details.
  21.  *
  22.  * You should have received a copy of the GNU General Public License
  23.  * along with this program.  If not, see {@link http://www.gnu.org/licenses/}.
  24.  *
  25.  * @package        PhpMyObject
  26.  * @subpackage PMO_Core
  27.  * @author        Nicolas Boiteux <nicolas_boiteux@yahoo.fr>
  28.  * @link            http://pmo.developpez.com/
  29.  * @since        PhpMyObject v0.1
  30.  * @version        $Revision: $
  31.  * @copyright    Copyright (C) 2007-2008 Nicolas Boiteux
  32.  * @license        GPLv3 {@link http://www.gnu.org/licenses/gpl}
  33.  * @filesource
  34.  *
  35.  */ 
  36.  
  37. /**
  38.  * This interface defines the methods a class must implement
  39.  * to provide a working PMO map class.
  40.  * 
  41.  * PMO_Map is a array of PMO_Objects.
  42.  * Each row of array contains as many PMO_Objects
  43.  * as there is table concerns by the SQL Request
  44.  *
  45.  * @package        PhpMyObject
  46.  * @subpackage PMO_Core
  47.  * @see            PMO_MyMap
  48.  */ 
  49. interface PMO_Map{
  50.     
  51.     /**
  52.      * Add an array of PMO_Object to map
  53.      * tablename=>PMO_Object
  54.      * 
  55.      * @return void 
  56.      */
  57.     public function add(array $row);
  58.         
  59.     /**
  60. /**
  61.      * build a new map from an other map
  62.      * this new map only contains row that are relative to the object
  63.      * 
  64.      * @return PMO_Map 
  65.      * @throws Exception
  66.      */
  67.     public function getMapByObject(PMO_Object $object);
  68.     
  69.     /**
  70.      * build a new map from a map that contains
  71.      * row relative to the object. This function
  72.      * use the values of the primary keys to retrieve
  73.      * the lines concerned.
  74.      * 
  75.      * Others value can stay NULL
  76.      * 
  77.      * @return PMO_Map 
  78.      * @throws Exception
  79.      */
  80.     public function getMapByObjectByValue(PMO_Object $object);
  81.     
  82.     /**
  83.      * Alias of getMapByObject
  84.      */
  85.     public function getMapLinked(PMO_Object $object);
  86.     
  87.     /**
  88.      * build a new map that only contains objects of type tablename
  89.      * relative to our object.
  90.      * 
  91.      * @return PMO_Map 
  92.      * @throws Exception
  93.      */
  94.     public function getMapRelated(PMO_Object $object$tablename);    
  95.     
  96.     /**
  97.      * build a new map that only contains objects of type tablename with attribute=value.
  98.      * Search is done only on one fields. Faster than getMapByObjectByValue but less powerfull.
  99.      * 
  100.      * @return PMO_Map 
  101.      * @throws Exception
  102.      */
  103.     public function getMapByValue($tablename$attribute$value);    
  104.     
  105.     /**
  106.      * build a new map that only contains objects of type tablename
  107.      * 
  108.      * @return PMO_Map 
  109.      * @throws Exception
  110.      */
  111.     public function getMapByTable($tablename);
  112.     
  113.     /**
  114.      * return one row of the array structure
  115.      * Null is returned at the end
  116.      * The array is not pop, it's only a cursor
  117.      * that move on index and return the results.
  118.      * 
  119.      * @return array 
  120.      */
  121.     public function fetch();
  122.  
  123.     /**
  124.      * returns one PMO_Object of row of the current map array structure
  125.      *
  126.      * Null is returned at the end and the iterator is reset.
  127.      * 
  128.      * The array is not poped, it's only a cursor that move
  129.      * an index and return the results.
  130.      * 
  131.      * @return PMO_Object 
  132.      */    
  133.     public function fetchTable($tablename);    
  134.     
  135.     /** 
  136.     * Return number of rows for this PMO_Map
  137.     */
  138.     public function count();
  139.  
  140.     /**
  141.      * retrieve first object in map matching with tablename, and attribute=>value
  142.      * If object is not find return an exception
  143.      * 
  144.      * @throws Exception
  145.      * @return PMO_Map 
  146.      */
  147.     public function getObjectByValue($tablename$attribute$value);
  148.  
  149.     /**
  150.      * retrieve one object in map comparing the value of primary key of object in param
  151.      * All primary keys must be set, it's more powerfull than getObjectByValue
  152.      * but slower too. If object is not find, return an exception
  153.      * 
  154.      * @throws Exception
  155.      * @return PMO_Object 
  156.      */
  157.     public function getObjectByObject(PMO_Object $object);
  158.     
  159. }
  160.  
  161.  
  162. ?>

Documentation generated on Wed, 15 Oct 2008 09:16:37 -0400 by phpDocumentor 1.4.1