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

Class: DB_DataObject_Generator

Source Location: /DB_DataObject-0.5/DataObject/Generator.php

Class Overview

DB_DataObject
   |
   --DB_DataObject_Generator

The main "DB_DataObject" class is really a base class for your own tables classes


Author(s):

Methods


Inherited Variables

Inherited Methods

Class: DB_DataObject

DB_DataObject::count()
find the number of results from a simple query
DB_DataObject::debug()
Debugger. - use this in your extended classes to output debugging information.
DB_DataObject::debugLevel()
sets and returns debug level eg. DB_DataObject::debugLevel(4);
DB_DataObject::delete()
Deletes items from table which match current objects variables
DB_DataObject::fetch()
fetches next row into this objects var's
DB_DataObject::fetchRow()
fetches a specific row into this object variables
DB_DataObject::find()
find results, either normal or crosstable
DB_DataObject::get()
get an result using key, value
DB_DataObject::getLink()
return name from related object
DB_DataObject::getLinkArray()
DB_DataObject::getLinks()
load related objects
DB_DataObject::groupBy()
Adds a group by condition
DB_DataObject::insert()
Insert the current objects variables into the database
DB_DataObject::limit()
Sets the Limit
DB_DataObject::orderBy()
Adds a order by condition
DB_DataObject::query()
sends raw query to database
DB_DataObject::raiseError()
Default error handling is to create a pear error, but never return it.
DB_DataObject::selectAdd()
Adds a select columns
DB_DataObject::setFrom()
Copies items that are in the table definitions from an array or object into the current object will not override key values.
DB_DataObject::staticGet()
a autoloading, caching static get method using key, value (based on get)
DB_DataObject::staticInitialize()
Define the $GLOBALS['_DB_DATAOBJECT_PRODUCTION'] variable
DB_DataObject::update()
Updates current objects variables into the database uses the _get_keys() to decide how to update Returns the TRUE on success
DB_DataObject::validate()
validate - override this to set up your validation rules
DB_DataObject::whereAdd()
Adds a condition to the WHERE statement, defaults to AND

Class Details

[line 51]
The main "DB_DataObject" class is really a base class for your own tables classes

// Set up the class by creating an ini file (refer to the manual for more details [DB_DataObject] database = mysql:/username:password@host/database schema_location = /home/myapplication/database class_location = /home/myapplication/DBTables/ clase_prefix = DBTables_

//Start and initialize...................... - dont forget the & $config = parse_ini_file('example.ini',TRUE); $options = &PEAR::setStaticProperty('DB_DataObject','options'); $options = $config['DB_DataObject'];

// example of a class (that does not use the 'auto generated tables data') class mytable extends DB_DataObject { // mandatory - set the table var $_database_dsn = "mysql://username:password@localhost/database"; var $__table = "mytable"; function _get_table() { return array( 'id' => 1, // integer or number 'name' => 2, // string ); } function _get_keys() { return array('id'); } }

// use in the application

Simple get one row

$instance = new mytable; $instance->get("id",12); echo $instance->somedata;

Get multiple rows

$instance = new mytable; $instance->whereAdd("ID > 12"); $instance->whereAdd("ID < 14"); $instance->find(); while ($instance->fetch()) { echo $instance->somedata; }



[ Top ]


Method Detail

generateClasses   [line 266]

void generateClasses( )


[ Top ]

start   [line 88]

none start( )

The 'starter' = call this to start the process
  • Access: public

[ Top ]


Documentation generated on Fri, 30 Apr 2004 21:37:41 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.