1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38:
<?php
namespace Inlm\Model;
use LeanMapper\Entity;
use LeanMapper\Filtering;
use LeanMapper\Fluent;
trait TEntity
{
use TEntityRowValue;
public function __set($name, $value)
{
$property = $this->getCurrentReflection()->getEntityProperty($name);
if ($property === NULL && $name !== 'Id' && substr($name, -2) === 'Id') {
$this->setRowValue(substr($name, 0, -2), $value);
} else {
parent::__set($name, $value);
}
}
public function __get($name)
{
$property = $this->getCurrentReflection()->getEntityProperty($name);
if ($property === NULL && $name !== 'Id' && substr($name, -2) === 'Id') {
return $this->getRowValue(substr($name, 0, -2));
}
return parent::__get($name);
}
}