diff --git a/src/ORM/Entity.php b/src/ORM/Entity.php index 79d2a67d7f4..93e4b2c36d9 100644 --- a/src/ORM/Entity.php +++ b/src/ORM/Entity.php @@ -56,6 +56,19 @@ public function __construct(array $properties = [], array $options = []) ]; $this->_className = get_class($this); + if (!empty($options['source'])) { + $this->source($options['source']); + } + + if ($options['markNew'] !== null) { + $this->isNew($options['markNew']); + } + + if (!empty($properties) && $options['markClean'] && !$options['useSetters']) { + $this->_properties = $properties; + return; + } + if (!empty($properties)) { $this->set($properties, [ 'setter' => $options['useSetters'], @@ -66,13 +79,5 @@ public function __construct(array $properties = [], array $options = []) if ($options['markClean']) { $this->clean(); } - - if ($options['markNew'] !== null) { - $this->isNew($options['markNew']); - } - - if (!empty($options['source'])) { - $this->source($options['source']); - } } }