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

Source for file PMO_Object.php

Documentation is available at PMO_Object.php

  1. <?php
  2. /**
  3.  * This file contains the PMO_Object 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 PMO_Object table class capable of managing
  44.  * database entities.
  45.  * 
  46.  * @package        PhpMyObject
  47.  * @subpackage PMO_Core
  48.  * @see            PMO_MyObject
  49.  */ 
  50. interface PMO_Object{
  51.     
  52.     /**
  53.      * Return the reference of the object PMO_Table
  54.      * linked to the object PMO_Table describe the
  55.      * structure of the table that was used to build
  56.      * the object data structure (name of columns,
  57.      * primary keys, ..)
  58.      * 
  59.      * @return PMO_Table 
  60.      * @throws Exception
  61.      */
  62.     public function getTable();    
  63.  
  64.     /**
  65.      * return the data structure of the PMO_Object
  66.      * array is
  67.      * attribute=>value
  68.      * 
  69.      * @throws Exception
  70.      */
  71.     public function getObjectAttribute();    
  72.     
  73.     /**
  74.      * return an array wich contains
  75.      * all the names of attributes of PMO_Object
  76.      * 
  77.      * @return array 
  78.      * @throws Exception
  79.      */    
  80.     public function getListAttribute();
  81.  
  82.     /**
  83.      * return the value of an attribute
  84.      * this function also cleans the escape chars
  85.      * with a simple stripslashes
  86.      * 
  87.      * @return string 
  88.      * @throws Exception
  89.      */
  90.     public function get($attribute);
  91.  
  92.     /**
  93.      * export the data structure of an object in a xml format stream
  94.      * <attributes>
  95.      * <attributename>attributevalue</attributename>
  96.      * </attributes>
  97.      */ 
  98.     public function toXml($encoding);    
  99.     
  100.     /**
  101.      * Set the value of an attribute of the data structure
  102.      * this function already escape strange char with
  103.      * a    simple addslashes
  104.      * 
  105.      * data structure is an array
  106.      * attribute => attributevalue
  107.      * 
  108.      * @throws Exception
  109.      * @return TRUE 
  110.      */
  111.     public function set($attribute$value);
  112.         
  113.     /**
  114.      * define the object as new, not already
  115.      * present in the database This flag
  116.      * is used to define when we do an insert
  117.      * or an update
  118.      * 
  119.      * 
  120.      * @return void 
  121.      */
  122.     public function setNew($flag);    
  123.     
  124.     /**
  125.      * return the flag used to define if
  126.      * objet is present or not in database
  127.      */    
  128.     public function getNew();
  129.     
  130.     /**
  131.      * Load data of object from database
  132.      * using the value of primary key
  133.      * All primary key should be
  134.      * set to retrieve the data
  135.      * 
  136.      * @throws Exception
  137.      * @return void 
  138.      */
  139.     public function load();    
  140.     
  141.     /**
  142.      * Delete data of object into database
  143.      * using the value of primary keys, all
  144.      * primary keys should be set to delete
  145.      * the right tuple
  146.      * 
  147.      * @throws Exception
  148.      * @return void 
  149.      */
  150.     public function delete();
  151.         
  152.     /**
  153.      * Save data of object into database
  154.      * insert or update dependings the value of
  155.      * the object_new flags
  156.      * 
  157.      * @throws Exception
  158.      */
  159.     public function save();
  160.     
  161. }
  162. ?>

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