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

Class: PMO_MyTable

Source Location: /fichiers/v0.15/PMO_core/PMO_MyTable.php

Class Overview


PMO_MyTable describes the data structure of your database tables.


Author(s):

Implements interfaces:

Variables

Methods



Class Details

[line 51]
PMO_MyTable describes the data structure of your database tables.

it is used to build the data structure of PMO_Object, retrieve the fields that are primary keys, use alias instead of the real name of columns.




Tags:

todo:  provide some examples and link to tutorials


[ Top ]


Class Variables

static $MAP = array()

[line 88]

an array of PMO_Table objects



Tags:

access:  protected

Type:   array


[ Top ]

$table_attribute = array()

[line 79]

holds the table attributes represented by this object and their values

This array holds the table columns name and their properties and values.

Columns attributes

  • Type the columns type: string, int, float, etc.
  • Null can the colun have null value: YES/NO
  • Key if value is PRI, the column is a primary key or part of it
  • Default value to default the column value with if none is provided
  • Extra is this column an auto_increment column? NULL/auto_increment
  • Perm the column permission: rw/r




Tags:

access:  protected

Type:   array


[ Top ]

$table_name =

[line 59]

this PMO_Table object name



Tags:

access:  protected

Type:   string


[ Top ]



Class Methods


static method factory [line 107]

static PMO_Table factory( string $tablename)

return a PMO_MyTable object from th PMO_MyTable directory or instanciates it if it does not exist yet.

factory() first checks to see if the wanted PMO_Table has already been registered. If so it returns it immediately.

Otherwise factory() will try to load the corresponding class from the PMO_MyTable/ directory.

If it does not exist, factory() will finally instanciate a generic PMO_Mytable object, get the table structure and persist it on disk and register it for the next instanciation.




Tags:

access:  public


Parameters:

string   $tablename   the table name

[ Top ]

method get [line 308]

array get( $attribute, string $attributename)

returns an attribute in the datastructure of object array is attribute => value



Tags:

return:  an array of attribute => value
throws:  Exception if $attributename does not exist
access:  public



Implementation of:
PMO_Table::get()
return an attribute in the datastructure of object array is attribute => value

Parameters:

string   $attributename   attribute name for which we want the properties
   $attribute  

[ Top ]

method getAutoincrement [line 166]

string|NULL getAutoincrement( )

retrieves the autoincrement field if it exists and returns it



Tags:

access:  public



Implementation of:
PMO_Table::getAutoincrement()
retrieves the autoincrement field if it exists and returns it
[ Top ]

method getClassname [line 335]

string|false getClassname( )

return the class name used to instanciate a PMO_Object corresponding to this PMO_Table



Tags:

return:  the class name of false if not set
access:  public



Implementation of:
PMO_Table::getClassname()
return the class name used to instanciate a PMO_Object corresponding to this PMO_Table
[ Top ]

method getColumns [line 239]

array getColumns( )

retrieves an array that contains all the table columns names, e.g. [0]=>nameofcolumn



Tags:

throws:  Exception if there is no attribute defined
access:  public



Implementation of:
PMO_Table::getColumns()
retrieve an array that contains all the name of the columns of the table [0]=>nameofcolumn
[ Top ]

method getFk [line 374]

array|false getFk( )

returns the table foreign keys



Tags:

return:  array of attributes value or false if none exist
todo:  this method returns the attribute value as a whole, should only return the foreign keys
throws:  Exception
access:  public



Implementation of:
PMO_Table::getFk()
retrieve all the foreign key of the object and return them in an array
[ Top ]

method getPerm [line 257]

string getPerm( string $attributename)

returns the permissions of an attribute: r=read, w=write



Tags:

throws:  Exception if the attribute is not defined
access:  public



Implementation of:
PMO_Table::getPerm()
return Perm of an attribute r=read, w=write

Parameters:

string   $attributename   name of the attribute for which we want the permissions

[ Top ]

method getPk [line 184]

array getPk( )

retrieves all the primary key of the object and returns them in an array

Permission must be "rw" for the key to be returned.




Tags:

throws:  Exception if the primary key is not defined
access:  public



Implementation of:
PMO_Table::getPk()
retrieve all the primary key of the object and return them in an array
[ Top ]

method getTableName [line 153]

string getTableName( )

retrieve the tablename of the object



Tags:

throws:  Exception if the table name is not set
access:  public



Implementation of:
PMO_Table::getTableName()
retrieve the tablename of the object
[ Top ]

method getType [line 271]

string getType( string $attributename)

returns the type of an attribute: string, int, float



Tags:

access:  public


Parameters:

string   $attributename   name of the attribute for which we want the type

[ Top ]

method isPk [line 215]

boolean isPk( $attributename, string $attributenane)

checks if the column is a primary key or not



Tags:

access:  public



Implementation of:
PMO_Table::isPk()
check if the column is a primary key or not

Parameters:

string   $attributenane   returns true if the attribute name is part of the table primary key
   $attributename  

[ Top ]

method issetAttribute [line 322]

boolean issetAttribute( string $attributename)

checks if an attribute exists or not for the provided attribute



Tags:

access:  public



Implementation of:
PMO_Table::issetAttribute()
check if an attribute exist or not in the table_alias

Parameters:

string   $attributename  

[ Top ]

method persist [line 395]

bool persist( )

creates a PMO_MyTable_xxx class at the first execution time, and flushes it to the disk this class extends the class PMO_MyTable,

describe the data structure of tables, describe the primary keys, and the class name to used to instanciate the PMO_Object




Tags:

access:  public



Implementation of:
PMO_Table::persist()
create a PMO_MyTable_xxx class at the first execution time, and flush it to the disk.
[ Top ]

method set [line 348]

void set( $attributevalue)

sets the attribute "Field" with a value



Tags:

access:  public



Implementation of:
PMO_Table::set()
set the attribute "Field" with a value

Parameters:

array   $attributevalue  

[ Top ]

method setFk [line 359]

void setFk( string $attributename, $value)

sets the foreign key for an attribute



Tags:

throws:  Exception if the attribute does not exist
access:  public



Implementation of:
PMO_Table::setFk()
set the forein keys of object with an array

Parameters:

string   $attributename  
array   $value  

[ Top ]

method setPerm [line 282]

void setPerm( string $attributename, string $value)

sets permission for an attribute (r=read, w=write)



Tags:

throws:  Exception if the attribute is not set
access:  public



Implementation of:
PMO_Table::setPerm()
set Perm of an attribute r=read, w=write

Parameters:

string   $attributename   attribute on which to set the permission
string   $value   the permission to set, e.g. "r" or "rw"

[ Top ]

method setPermForAll [line 294]

void setPermForAll( string $value)

sets permissions for all attributes (r=read, w=write)



Tags:

access:  public



Implementation of:
PMO_Table::setPermForAll()
set Perm for all attributes r=read, w=write

Parameters:

string   $value   permission to set, e.g. "r" or "rw"

[ Top ]

method setPk [line 204]

void setPk( string $attributename)

sets the primary keys of an object with an array



Tags:

access:  public



Implementation of:
PMO_Table::setPk()
set the primary keys of object with an array

Parameters:

string   $attributename   a column name that is the table primary key or part of it return void

[ Top ]

method setTableName [line 228]

void setTableName( string $tablename)

sets the table name of the object



Tags:

access:  public



Implementation of:
PMO_Table::setTableName()
set the tablename of the object

Parameters:

string   $tablename  

[ Top ]


Documentation generated on Wed, 15 Oct 2008 09:17:53 -0400 by phpDocumentor 1.4.1