Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 62 → Rev 55

/trunk/Model.php
8,7 → 8,6
* Provides simple mapping of a model object to records of
* a table of a relational database.
*
* @property Db\Table $persistentTable
* @author Thomas Lahn
*/
abstract class Model extends \PointedEars\PHPX\AbstractModel
127,22 → 126,14
* Finds the record for the model object in the table, fills
* the object with missing data, and returns the result.
*
* @param mixed $id = null
* The ID of the object to find. If <code>null</code> (default),
* the object is search for by its current ID.
* @see Table::find(Model)
* @return Model|null
* This object filled with missing data, or <code>null</code>
* if there is no data for this object
*/
public function find ($id = null)
public function find ()
{
$class = \get_class($this);
if ($id !== null)
{
$this->{$class::$_persistentId} = $id;
}
 
$result = $this->persistentTable->find($this->{$class::$_persistentId});
if ($result)
{
160,8 → 151,6
* in the database. The default is to save the values
* of all persistent properties.
* @return boolean
* The return value of
* <code>$this->persistentTable->updateOrInsert()</code>.
* @see Model::getPropertyArray()
* @see Table::updateOrInsert()
*/