Answer the question
In order to leave comments, you need to log in
The doctrine does not work due to the fact that I read and write properties through __call (), can I somehow get around this?
I don't have Symfony, there is something similar https://symfony.com/doc/current/components/propert...
static $fields = [
'id', 'code', 'fullName', 'number', 'color',
'series', 'weight', 'volume', 'status', 'specStatus', 'type', 'urgency'
];
public function __call($nameFunction, $arguments)
{
if (strlen($nameFunction) < 4):
return;
endif;
$prefix = substr($nameFunction, 0, 3);
$name = lcfirst(substr($nameFunction, 3, strlen($nameFunction) - 3));
$inFields = array_search($name, self::$fields);
if ($prefix == 'get'):
if ($inFields):
return $this->$name;
endif;
endif;
if ($prefix == 'set'):
if ($inFields):
$value = $arguments[0];
$this->$name = $value;
endif;
endif;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question