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

Class: PMO_MyObject

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

Class Overview


This class describe a generic PMO_Object that represents a tuple from the database. It's a model class (the M part of the MVC design pattern) that enables you to create, read, update and delete data (CRUD).


Author(s):

Implements interfaces:

Variables

Methods


Child classes:

film_actor
provides the much needed helloworld() method to those film_actor people who need so much publicity

Class Details

[line 54]
This class describe a generic PMO_Object that represents a tuple from the database. It's a model class (the M part of the MVC design pattern) that enables you to create, read, update and delete data (CRUD).

This class can be extended by adding methods or fields and load dynamically via the PMO_Table mecanism




Tags:

tutorial:  Manual.pkg
tutorial:  PhpMyObject.Quickstart.pkg
see:  class_film_actor.php


[ Top ]


Class Variables

$object_attribute =

[line 66]

holds the object attributes



Tags:

access:  protected

Type:   PMO_MyArray


[ Top ]

$object_new =  TRUE

[line 73]

boolean flag indicating if this object is a new one or

has already been loaded through the load() method




Tags:

access:  protected

Type:   bool


[ Top ]

$object_table =

[line 60]

holds the related PMO_Table object



Tags:

access:  protected

Type:   object


[ Top ]



Class Methods


static method factory [line 118]

static PMO_Object factory( string $tablename)

returns an object conforming to the database table schema

This factory calls an internal factory that is used to load your own class if it exists in the class_loader directory and is referenced in the property $table_classname in the corresponding PMO_Table/PMO_Table_Classname.php file.




Tags:

access:  public


Parameters:

string   $tablename   the database table name to use for building the PMO_Object object

[ Top ]

static method internalfactory [line 95]

static PMO_Object internalfactory( PMO_Table $table)

this internal factory will instanciate either PMO_Object based on an extended class in your class_loader directory or a generic PMO_MyObject object.



Tags:

access:  public


Parameters:

object   $table   a PMO_Table object

[ Top ]

constructor __construct [line 82]

PMO_MyObject __construct( PMO_Table $table)

the constructor takes a PMO_Table argument and sets ifself up up so factory() will be able to create and return a PMO_Object



Tags:

access:  protected


Parameters:

object   $table   a PMO_Table object

[ Top ]

method delete [line 303]

void delete( )

Deletes the corespondgng data row from the database table

primary key needs to be set beforehand to delete the right tuple




Tags:

throws:  Exception
access:  public



Implementation of:
PMO_Object::delete()
Delete data of object into database
[ Top ]

method fetch [line 184]

void fetch( )



Tags:

access:  public


[ Top ]

method get [line 177]

void get( sting $attribute)

retrieve the value of an attribute this function also cleans the escape chars with a simple stripslashes



Tags:

throws:  Exception
access:  public



Implementation of:
PMO_Object::get()
return the value of an attribute this function also cleans the escape chars with a simple stripslashes

Parameters:

sting   $attribute  

[ Top ]

method getListAttribute [line 160]

array getListAttribute( )

return an array wich contains all the names of attributes of PMO_Object



Tags:

throws:  Exception
access:  public



Implementation of:
PMO_Object::getListAttribute()
return an array wich contains all the names of attributes of PMO_Object
[ Top ]

method getNew [line 273]

bool getNew( )

return the flag used to define if the objet is already present in database table



Tags:

access:  public



Implementation of:
PMO_Object::getNew()
return the flag used to define if
[ Top ]

method getObjectAttribute [line 147]

PMO_MyArray getObjectAttribute( )

return the data structure of the PMO_Object array is attribute=>value



Tags:

throws:  Exception
access:  public



Implementation of:
PMO_Object::getObjectAttribute()
return the data structure of the PMO_Object array is attribute=>value
[ Top ]

method getTable [line 133]

PMO_Table getTable( )

Returns a reference to the PMO_Table object on which this object is based

PMO_Table describe the structure of the table that was used to build the object data structure (column names, primary keys, ..)




Tags:

throws:  Exception if the PMO_Table is undefined
access:  public



Implementation of:
PMO_Object::getTable()
Return the reference of the object PMO_Table
[ Top ]

method insert [line 349]

void insert( )

inserts a new data row into the database table

Fields must be filled beforehand.




Tags:

throws:  Exception
access:  public


[ Top ]

method load [line 286]

void load( )

Loads a data row from the database table using its primary key and fills the object attributes

Primary key needs to be set beforehand




Tags:

throws:  Exception
access:  public



Implementation of:
PMO_Object::load()
Load data of object from database
[ Top ]

method save [line 320]

void save( )

Save this object into the corresponding database table

If this is a new object, it will be inserted. Otherwise an update will be performed.




Tags:

throws:  Exception
access:  public



Implementation of:
PMO_Object::save()
Save data of object into database insert or update dependings the value of the object_new flags
[ Top ]

method set [line 201]

bool set( $attribute, mixed $value, string $alias)

Set the value of an attribute of the data structure this function already escape strange char with a simple addslashes

data structure is an array attribute => value




Tags:

return:  always TRUE
throws:  Exception
access:  public



Implementation of:
PMO_Object::set()
Set the value of an attribute of the data structure this function already escape strange char with a simple addslashes

Parameters:

string   $alias   column alias
mixed   $value   value to set the attribute to
   $attribute  

[ Top ]

method setNew [line 260]

void setNew( bool $flag)

define the object as new, not already present in the database

This flag is used to define when we do an insert or an update




Tags:

access:  public



Implementation of:
PMO_Object::setNew()
define the object as new, not already

Parameters:

bool   $flag  

[ Top ]

method toXml [line 219]

void toXml( $encoding)

export the data structure of an object in a xml format stream

  1.  <attributes>
  2.         <attributename>attributevalue</attributename>
  3.  </attributes>




Tags:

access:  public



Implementation of:
PMO_Object::toXml()
export the data structure of an object in a xml format stream

Parameters:

   $encoding  

[ Top ]

method update [line 333]

void update( )

updates the corresponding data row into the database table



Tags:

throws:  Exception
access:  public


[ Top ]

method __get [line 248]

mixed __get( string $attributename)

alias of get function



Tags:

see:  PMO_MyObject::get()
access:  public


Parameters:

string   $attributename  

[ Top ]

method __set [line 237]

void __set( string $attributename, mixed $attributevalue)

alias of set function



Tags:

see:  PMO_MyObject::set()
access:  public


Parameters:

string   $attributename  
mixed   $attributevalue  

[ Top ]


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