Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 49 → Rev 48

/trunk/Db/Mapper.php
1,6 → 1,5
<?php
 
require_once __DIR__ . '/../AbstractModel.php';
require_once __DIR__ . '/Table.php';
 
/**
8,7 → 7,7
*
* @author Thomas Lahn
*/
abstract class Mapper extends AbstractModel
abstract class Mapper
{
/**
* Class name of the associated table model
16,9 → 15,9
* @var string
*/
protected $_table = 'Table';
 
protected $_dbTable;
 
/**
* Sets the {@link Table} for this mapper
* @param string|Table $dbTable
31,11 → 30,11
{
$table = new $table();
}
 
if (!($table instanceof Table)) {
throw new Exception('Invalid table data gateway provided');
}
 
$this->_dbTable = $table;
}
 
57,24 → 56,14
{
$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.
*
93,7 → 82,7
{
return 0;
}
 
return ($a->$property < $b->$property) ? -1 : 1;
}
}