Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 55 → Rev 54

/trunk/Model.php
27,7 → 27,7
*
* @type string|array[string]
*/
protected static $_persistentId = 'id';
protected $_persistentId = 'id';
 
/**
* The names of the properties that should be used in database
43,7 → 43,7
*
* @type array
*/
protected static $_persistentProperties = array();
protected $_persistentProperties = array();
 
/**
* Creates a new model object
105,8 → 105,7
 
if ($propertyNames === null)
{
$class = \get_class($this);
$propertyNames = $class::$_persistentProperties;
$propertyNames = $this->_persistentProperties;
}
 
foreach ($propertyNames as $propertyName => $columnName)
134,7 → 133,7
public function find ()
{
$class = \get_class($this);
$result = $this->persistentTable->find($this->{$class::$_persistentId});
$result = $this->persistentTable->find($this->{$this->_persistentId});
if ($result)
{
return $this->map($result);
157,8 → 156,7
public function save (array $propertyNames = null)
{
$table = $this->persistentTable;
$class = \get_class($this);
$idPropertyName = $class::$_persistentId;
$idPropertyName = $this->_persistentId;
 
$result = $table->updateOrInsert(
$this->getPropertyArray($propertyNames),
189,8 → 187,7
public function insert (array $propertyNames = null)
{
$table = $this->persistentTable;
$class = \get_class($this);
$idPropertyName = $class::$_persistentId;
$idPropertyName = $this->_persistentId;
 
$result = $table->insert($this->getPropertyArray($propertyNames));
 
210,7 → 207,6
*/
public function delete ()
{
$class = \get_class($this);
return $this->persistentTable->delete($this->{$class::$_persistentId});
return $this->persistentTable->delete($this->{$this->_persistentId});
}
}