Switch to attribute for "Station Requires Restart" detection.
This commit is contained in:
parent
aedb329948
commit
b7984a5f75
|
@ -4,7 +4,6 @@ namespace App\Doctrine\Event;
|
||||||
|
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Entity\Attributes\AuditIgnore;
|
use App\Entity\Attributes\AuditIgnore;
|
||||||
use Doctrine\Common\Annotations\Reader;
|
|
||||||
use Doctrine\Common\EventSubscriber;
|
use Doctrine\Common\EventSubscriber;
|
||||||
use Doctrine\ORM\Event\OnFlushEventArgs;
|
use Doctrine\ORM\Event\OnFlushEventArgs;
|
||||||
use Doctrine\ORM\Events;
|
use Doctrine\ORM\Events;
|
||||||
|
@ -16,11 +15,6 @@ use ReflectionObject;
|
||||||
*/
|
*/
|
||||||
class StationRequiresRestart implements EventSubscriber
|
class StationRequiresRestart implements EventSubscriber
|
||||||
{
|
{
|
||||||
public function __construct(
|
|
||||||
protected Reader $reader
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
@ -58,9 +52,8 @@ class StationRequiresRestart implements EventSubscriber
|
||||||
$class_reflection = new ReflectionObject($entity);
|
$class_reflection = new ReflectionObject($entity);
|
||||||
foreach ($changes as $change_field => $changeset) {
|
foreach ($changes as $change_field => $changeset) {
|
||||||
$property = $class_reflection->getProperty($change_field);
|
$property = $class_reflection->getProperty($change_field);
|
||||||
$annotation = $this->reader->getPropertyAnnotation($property, AuditIgnore::class);
|
$ignoreAttr = $property->getAttributes(AuditIgnore::class);
|
||||||
|
if (!empty($ignoreAttr)) {
|
||||||
if (null !== $annotation) {
|
|
||||||
unset($changes[$change_field]);
|
unset($changes[$change_field]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue