->tableName()

->tableName() – Get or set the table name of an object

Synopsis

object $DB_DataObject->tableName ( string $name )

Description

Without any argument, it returns the table name that the object deals with. With a string, it will set the table name for the instance of the object.

Note

This function can not be called statically.

Example

getting and setting the tablename

<?php
$person 
= new DataObjects_Person;
echo 
$person->tableName();
// echo's person


// now use the same object to query the extra_people table

$person->tableName('extra_people');
$person->id 12;
$person->find(true);


// you can also use this in conjunction with table(), to create dataobjects for random tables..

$d = new DB_DataObject;
$d->tableName('person');
$d->table(array(
  
'id'   => DB_DATAOBJECT_INT,
  
'name' => DB_DATAOBJECT_STRING,
));
$d->keys(array('id'));

$d->id 12;
$d->find(true);
// should do the same as above..!
?>
check object data, and call objects validation methods. (Previous) Get or set the database the object uses (Next)
Last updated: Fri, 29 Aug 2014 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.