Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 51 → Rev 52

/trunk/AbstractModel.php
8,10 → 8,10
interface ILocalizable
{
/**
* Localizes this model. The actual implementation is left to the model class
* implementing this interface.
* Localizes this model. The actual implementation is left to
* the model class implementing this interface.
*/
function localize();
function localize ();
}
 
/**
30,7 → 30,7
* @param array $data Initialization data (optional)
* @param array $mapping Mapping for initialization data (optional)
*/
protected function __construct(array $data = null, array $mapping = null)
protected function __construct (array $data = null, array $mapping = null)
{
if (!is_null($data))
{
45,14 → 45,14
* @throws ModelPropertyException
* @return mixed
*/
public function __get($name)
public function __get ($name)
{
/* Support for Object-Relational Mappers */
if (strpos($name, 'persistent') === 0)
{
$class = get_class($this);
return $class::${$name};
}
// if (strpos($name, 'persistent') === 0)
// {
// $class = get_class($this);
// return $class::${$name};
// }
 
$method = 'get' . ucfirst($name);
 
76,7 → 76,7
* @param mixed $value The new property value before assignment
* @throws ModelPropertyException
*/
public function __set($name, $value)
public function __set ($name, $value)
{
$method = 'set' . ucfirst($name);
 
102,7 → 102,7
* @return boolean
* @see getPropertyVars()
*/
private static function _isPropertyVar($varName)
private static function _isPropertyVar ($varName)
{
return preg_match('/^_\\w/', $varName) > 0;
}
115,7 → 115,7
* @return string
* @see getPropertyVars()
*/
private static function _toPropertyVar($varName)
private static function _toPropertyVar ($varName)
{
return preg_replace('/^_(\\w)/', '\\1', $varName);
}
126,7 → 126,7
*
* @return array
*/
public function getPropertyVars()
public function getPropertyVars ()
{
return array_map(
array('self', '_toPropertyVar'),
159,7 → 159,7
* @return AbstractModel
* The modified object
*/
public function map(array $data, array $mapping = null, $exclusive = false)
public function map (array $data, array $mapping = null, $exclusive = false)
{
if (is_null($mapping))
{