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

Source for file PMO_Table.php

Documentation is available at PMO_Table.php

  1. <?php
  2. /**
  3.  * This file contains the PMO_Table 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.  * Copyright (c) 2007-2008 Nicolas Boiteux
  13.  *
  14.  * LICENSE
  15.  *
  16.  * PhpMyObject is free software: you can redistribute it and/or modify
  17.  * it under the terms of the GNU General Public License as published by
  18.  * the Free Software Foundation, either version 3 of the License, or
  19.  * (at your option) any later version.
  20.  *
  21.  * This program is distributed in the hope that it will be useful,
  22.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
  24.  * GNU General Public License for more details.
  25.  *
  26.  * You should have received a copy of the GNU General Public License
  27.  * along with this program.  If not, see {@link http://www.gnu.org/licenses/}.
  28.  *
  29.  * @package        PhpMyObject
  30.  * @subpackage PMO_Core
  31.  * @author        Nicolas Boiteux <nicolas_boiteux@yahoo.fr>
  32.  * @link            http://pmo.developpez.com/
  33.  * @since        PhpMyObject v0.1x
  34.  * @version        $Revision: $
  35.  * @copyright    Copyright (C) 2007-2008 Nicolas Boiteux
  36.  * @license        GPLv3 {@link http://www.gnu.org/licenses/gpl}
  37.  * @filesource
  38.  *
  39.  */ 
  40.  
  41. /**
  42.  * This interface defines the methods a class must implement
  43.  * to provide a working table class capable of describing
  44.  * and working with a database table.
  45.  * 
  46.  * @package        PhpMyObject
  47.  * @subpackage PMO_Core
  48.  * @see            PMO_MyTable
  49.  */ 
  50. interface PMO_Table{
  51.  
  52.     /**
  53.      * retrieve the tablename of the object
  54.      * 
  55.      * @return string 
  56.      * @throws Exception
  57.      */    
  58.     public function getTableName();
  59.  
  60.     /**
  61.      * check if the column is a primary key or not
  62.      * 
  63.      * @return boolean 
  64.      */
  65.     public function isPk($pk);    
  66.  
  67.     /**
  68.      * retrieves the autoincrement field if it exists
  69.      * and returns it
  70.     * 
  71.     * @return string|NULL
  72.     */
  73.     public function getAutoincrement();    
  74.     
  75.     /**
  76.      * retrieve all the primary key of the object
  77.      * and return them in an array
  78.      * 
  79.      * @return array 
  80.      * @throws Exception
  81.      */    
  82.     public function getPk();
  83.  
  84.     /**
  85.      * set the primary keys of object with
  86.      * an array
  87.      * 
  88.      * return void
  89.      */
  90.     public function setPk($attributename);    
  91.  
  92.     /**
  93.      * set the forein keys of object with
  94.      * an array
  95.      * 
  96.      * array($tablename=>$keyname)
  97.      * 
  98.      * return void
  99.      */    
  100.     public function setFk($attributenamearray $array);
  101.  
  102.     /**
  103. /**
  104.      * retrieve all the foreign key of the object
  105.      * and return them in an array
  106.      * 
  107.      * @return array|FALSE
  108.      */        
  109.     public function getFk();
  110.     
  111.     /**
  112.      * set the tablename of the object
  113.      * 
  114.      * @return void 
  115.      */
  116.     public function setTableName($tablename);    
  117.     
  118.     /**
  119.      * retrieve an array that contains all the
  120.      * name of the columns of the table
  121.      * [0]=>nameofcolumn
  122.      * 
  123.      * @return array 
  124.      * @throws Exception
  125.      */
  126.     public function getColumns();    
  127.     
  128.     /**
  129.      * return an array that contains
  130.      * nameofcolumn=>aliasofcolumn
  131.      * 
  132.      * @return array 
  133.      * @throws Exception
  134.      */
  135.     //public function getAlias();
  136.     
  137.     /**
  138.      * return Perm of an attribute r=read, w=write
  139.      * 
  140.      * @return string 
  141.      * @throws Exception
  142.      */
  143.     public function getPerm($attributename);
  144.  
  145.     /**
  146.      * set Perm of an attribute r=read, w=write
  147.      * @throws Exception
  148.      */
  149.     public function setPerm($attributename$value);    
  150.  
  151.     /**
  152.      * set Perm for all attributes r=read, w=write
  153.      */
  154.     public function setPermForAll($value);    
  155.     
  156.     /**
  157.      * retrieve the real name of column from its alias
  158.      * 
  159.      * @return array 
  160.      * @throws Exception
  161.      */
  162.     //public function getReverseAlias($alias);
  163.  
  164.     /**
  165.      * return an attribute in the datastructure of object
  166.      * array is
  167.      * attribute => value
  168.      * 
  169.      * @throws Exception
  170.      */
  171.     public function get($attributename);    
  172.  
  173.     /**
  174.      * check if an alias exist or not in the table_alias
  175.      * 
  176.      * @return boolean 
  177.      */
  178.     //public function issetAlias($aliasname);
  179.  
  180.     /**
  181.      * check if an attribute exist or not in the table_alias
  182.      * 
  183.      * @return boolean 
  184.      */
  185.     public function issetAttribute($attributename);    
  186.     
  187.     /**
  188.      * return the class name used to instanciate a PMO_Object
  189.      * corresponding to this PMO_Table
  190.      * 
  191.      * @return FALSE 
  192.      */
  193.     public function getClassname();    
  194.     
  195.     /**
  196.      * set the attribute "Field" with a value
  197.      * 
  198.      * @return void 
  199.      */
  200.     public function set(array $attributevalue);
  201.  
  202.     /**
  203. /**
  204.      * create a PMO_MyTable_xxx class at the first execution time, and
  205.      * flush it to the disk.
  206.      *
  207.      * This class describe the data structure of tables, their primary keys,
  208.      * columns aliases and the class name to used to instanciate
  209.      * the PMO_Object.
  210.      * 
  211.      * @return TRUE 
  212.      */
  213.     public function persist();    
  214.     
  215. }
  216. ?>

Documentation generated on Wed, 15 Oct 2008 09:18:10 -0400 by phpDocumentor 1.4.1