mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Feature: force to add updatedAt and createdAt even if no user iss associated
This commit is contained in:
parent
722f053f06
commit
fcbc00d0f1
@ -41,12 +41,12 @@ class TrackCreateUpdateSubscriber implements EventSubscriber
|
||||
{
|
||||
$object = $args->getObject();
|
||||
|
||||
if (
|
||||
$object instanceof TrackCreationInterface
|
||||
&& $this->security->getUser() instanceof User
|
||||
) {
|
||||
$object->setCreatedBy($this->security->getUser());
|
||||
if ($object instanceof TrackCreationInterface) {
|
||||
$object->setCreatedAt(new DateTimeImmutable('now'));
|
||||
|
||||
if ($this->security->getUser() instanceof User) {
|
||||
$object->setCreatedBy($this->security->getUser());
|
||||
}
|
||||
}
|
||||
|
||||
$this->onUpdate($object);
|
||||
@ -61,12 +61,12 @@ class TrackCreateUpdateSubscriber implements EventSubscriber
|
||||
|
||||
protected function onUpdate(object $object): void
|
||||
{
|
||||
if (
|
||||
$object instanceof TrackUpdateInterface
|
||||
&& $this->security->getUser() instanceof User
|
||||
) {
|
||||
$object->setUpdatedBy($this->security->getUser());
|
||||
$object->setUpdatedAt(new DateTimeImmutable('now'));
|
||||
if ($object instanceof TrackUpdateInterface) {
|
||||
$object->setUpdatedAt(new DateTimeImmutable('now'));
|
||||
|
||||
if ($this->security->getUser() instanceof User) {
|
||||
$object->setUpdatedBy($this->security->getUser());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user