Internal: Change event args for entity listeners

pull/4853/head
Angel Fernando Quiroz Campos 1 year ago
parent 53a53a3a0f
commit 234c80d41a
  1. 4
      src/CoreBundle/Entity/Listener/MessageListener.php
  2. 10
      src/CoreBundle/Entity/Listener/ResourceListener.php
  3. 1
      src/CoreBundle/Entity/Listener/ResourceNodeListener.php
  4. 9
      src/CoreBundle/Entity/Listener/SessionListener.php
  5. 5
      src/CoreBundle/Entity/Listener/SkillRelUserListener.php
  6. 7
      src/CoreBundle/Entity/Listener/UserListener.php

@ -7,7 +7,7 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Entity\Listener;
use Chamilo\CoreBundle\Entity\Message;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PostPersistEventArgs;
use Symfony\Component\Messenger\MessageBusInterface;
class MessageListener
@ -17,7 +17,7 @@ class MessageListener
) {
}
public function postPersist(Message $message, LifecycleEventArgs $args): void
public function postPersist(Message $message, PostPersistEventArgs $args): void
{
if ($message) {
// Creates an outbox version, if message is sent in the inbox.

@ -9,7 +9,6 @@ namespace Chamilo\CoreBundle\Entity\Listener;
use Chamilo\CoreBundle\Controller\Api\BaseResourceFileAction;
use Chamilo\CoreBundle\Entity\AbstractResource;
use Chamilo\CoreBundle\Entity\AccessUrl;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\EntityAccessUrlInterface;
use Chamilo\CoreBundle\Entity\PersonalFile;
use Chamilo\CoreBundle\Entity\ResourceFile;
@ -18,16 +17,15 @@ use Chamilo\CoreBundle\Entity\ResourceNode;
use Chamilo\CoreBundle\Entity\ResourceToRootInterface;
use Chamilo\CoreBundle\Entity\ResourceType;
use Chamilo\CoreBundle\Entity\ResourceWithAccessUrlInterface;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Tool\ToolChain;
use Chamilo\CoreBundle\Traits\AccessUrlListenerTrait;
use Cocur\Slugify\SlugifyInterface;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PostUpdateEventArgs;
use Doctrine\ORM\Event\PrePersistEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Exception;
use InvalidArgumentException;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
@ -50,7 +48,7 @@ class ResourceListener
*
* @throws Exception
*/
public function prePersist(AbstractResource $resource, LifecycleEventArgs $eventArgs): void
public function prePersist(AbstractResource $resource, PrePersistEventArgs $eventArgs): void
{
$em = $eventArgs->getObjectManager();
$request = $this->request;
@ -276,7 +274,7 @@ class ResourceListener
//$this->setLinks($resource, $eventArgs->getEntityManager());
}
public function postUpdate(AbstractResource $resource, LifecycleEventArgs $eventArgs): void
public function postUpdate(AbstractResource $resource, PostUpdateEventArgs $eventArgs): void
{
//error_log('resource listener postUpdate');
//$em = $eventArgs->getEntityManager();

@ -10,7 +10,6 @@ use Chamilo\CoreBundle\Entity\ResourceNode;
use Chamilo\CoreBundle\Repository\ResourceNodeRepository;
use Chamilo\CoreBundle\Tool\ToolChain;
use Cocur\Slugify\SlugifyInterface;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Security;

@ -6,11 +6,10 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Entity\Listener;
use Chamilo\CoreBundle\Entity\AccessUrl;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CoreBundle\Traits\AccessUrlListenerTrait;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PrePersistEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Exception;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Security;
@ -34,7 +33,7 @@ class SessionListener
*
* @throws Exception
*/
public function prePersist(Session $session, LifecycleEventArgs $args): void
public function prePersist(Session $session, PrePersistEventArgs $args): void
{
$em = $args->getObjectManager();
if (0 === $session->getUrls()->count()) {
@ -52,7 +51,7 @@ class SessionListener
/**
* This code is executed when a session is updated.
*/
public function preUpdate(Session $session, LifecycleEventArgs $args): void
public function preUpdate(Session $session, PreUpdateEventArgs $args): void
{
}

@ -6,12 +6,11 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Entity\Listener;
use Chamilo\CoreBundle\Entity\Message;
use Chamilo\CoreBundle\Entity\SkillRelUser;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Settings\SettingsManager;
use Display;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PostPersistEventArgs;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
@ -26,7 +25,7 @@ class SkillRelUserListener
) {
}
public function postPersist(SkillRelUser $skillRelUser, LifecycleEventArgs $event): void
public function postPersist(SkillRelUser $skillRelUser, PostPersistEventArgs $event): void
{
$user = $skillRelUser->getUser();
$skill = $skillRelUser->getSkill();

@ -9,7 +9,8 @@ namespace Chamilo\CoreBundle\Entity\Listener;
use Chamilo\CoreBundle\Entity\ResourceNode;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PrePersistEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Core\Security;
@ -24,7 +25,7 @@ class UserListener
/**
* This code is executed when a new user is created.
*/
public function prePersist(User $user, LifecycleEventArgs $args): void
public function prePersist(User $user, PrePersistEventArgs $args): void
{
$this->userRepository->updateCanonicalFields($user);
$this->userRepository->updatePassword($user);
@ -66,7 +67,7 @@ class UserListener
/**
* This code is executed when a user is updated.
*/
public function preUpdate(User $user, LifecycleEventArgs $args): void
public function preUpdate(User $user, PreUpdateEventArgs $args): void
{
$this->userRepository->updatePassword($user);
$this->userRepository->updateCanonicalFields($user);

Loading…
Cancel
Save