Skip to content

Commit 0ebe975

Browse files
committed
TEntity: fix - ignores existed properties
1 parent 4d6d8e3 commit 0ebe975

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/TEntity.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ trait TEntity
1414

1515
public function __set($name, $value)
1616
{
17-
if ($name !== 'Id' && substr($name, -2) === 'Id') {
17+
$property = $this->getCurrentReflection()->getEntityProperty($name);
18+
19+
if ($property === NULL && $name !== 'Id' && substr($name, -2) === 'Id') {
1820
$this->setRowValue(substr($name, 0, -2), $value);
1921

2022
} else {
@@ -25,7 +27,9 @@ public function __set($name, $value)
2527

2628
public function __get($name)
2729
{
28-
if ($name !== 'Id' && substr($name, -2) === 'Id') {
30+
$property = $this->getCurrentReflection()->getEntityProperty($name);
31+
32+
if ($property === NULL && $name !== 'Id' && substr($name, -2) === 'Id') {
2933
return $this->getRowValue(substr($name, 0, -2));
3034
}
3135
return parent::__get($name);

0 commit comments

Comments
 (0)