Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 48 → Rev 49

/trunk/Db/Mapper.php
1,5 → 1,6
<?php
 
require_once __DIR__ . '/../AbstractModel.php';
require_once __DIR__ . '/Table.php';
 
/**
7,7 → 8,7
*
* @author Thomas Lahn
*/
abstract class Mapper
abstract class Mapper extends AbstractModel
{
/**
* Class name of the associated table model
15,9 → 16,9
* @var string
*/
protected $_table = 'Table';
 
protected $_dbTable;
 
/**
* Sets the {@link Table} for this mapper
* @param string|Table $dbTable
30,11 → 31,11
{
$table = new $table();
}
 
if (!($table instanceof Table)) {
throw new Exception('Invalid table data gateway provided');
}
 
$this->_dbTable = $table;
}
 
56,14 → 57,24
{
$table = $this->_table;
}
 
$this->setDbTable($table);
}
 
return $this->_dbTable;
}
 
/**
* Returns the <code>Table</code> for this object.
*
* @return Table
*/
public function getTable ()
{
return $this->getDbTable();
}
 
/**
* Sorts an array of objects by the property of the nested object.
* To be used with the u*sort() functions.
*
82,7 → 93,7
{
return 0;
}
 
return ($a->$property < $b->$property) ? -1 : 1;
}
}