mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
implements trackable on accompanying period
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Chill\MainBundle\Doctrine\Event;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Doctrine\Common\EventSubscriber;
|
||||
use Doctrine\ORM\Events;
|
||||
use Doctrine\Persistence\Event\LifecycleEventArgs;
|
||||
@@ -37,7 +38,8 @@ class TrackCreateUpdateSubscriber implements EventSubscriber
|
||||
{
|
||||
$object = $args->getObject();
|
||||
|
||||
if ($object instanceof TrackCreationInterface) {
|
||||
if ($object instanceof TrackCreationInterface
|
||||
&& $this->security->getUser() instanceof User) {
|
||||
$object->setCreatedBy($this->security->getUser());
|
||||
$object->setCreatedAt(new \DateTimeImmutable('now'));
|
||||
}
|
||||
@@ -54,7 +56,8 @@ class TrackCreateUpdateSubscriber implements EventSubscriber
|
||||
|
||||
protected function onUpdate(object $object): void
|
||||
{
|
||||
if ($object instanceof TrackUpdateInterface) {
|
||||
if ($object instanceof TrackUpdateInterface
|
||||
&& $this->security->getUser() instanceof User) {
|
||||
$object->setUpdatedBy($this->security->getUser());
|
||||
$object->setUpdatedAt(new \DateTimeImmutable('now'));
|
||||
}
|
||||
|
Reference in New Issue
Block a user