Commit b4010ca6 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

[FIX] $this->url(null,[],[],true) provoquait l'erreur 'No RouteMatch instance...

[FIX] $this->url(null,[],[],true) provoquait l'erreur 'No RouteMatch instance provided' : injections de UrlPlugin plutôt que UrlHelper car le RouteMatch n'est pas encore calculé et dispo dans ce dernier (cf. tâche #59885).
parent 98ae91b7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ infobulle d'explication en cas de contrainte non respectée (ex: nb d'émérites
- [FIX] Config : plus de fonctions directement dans des fichiers de config, ça vilain et ça complique les tests fonctionnels
- [FIX] Recherche des engagements d'impartialité existants : ajout de la jointure sur Individu il peut rester des engagements non supprimés !
- [FIX] Module Saisie de thèse : Enregistrement impossible des généralites si aucune discipline renseignée
- [FIX] $this->url(null,[],[],true) provoquait l'erreur 'No RouteMatch instance provided' : injections de UrlPlugin plutôt que UrlHelper car le RouteMatch n'est pas encore calculé et dispo dans ce dernier (cf. tâche #59885).

9.1.1
-----
+5 −8
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ use Application\Entity\Db\MailConfirmation;
use Application\Entity\Db\Role;
use Application\Entity\Db\Utilisateur;
use Individu\Entity\Db\Individu;
use Laminas\View\Helper\Url as UrlHelper;
use Laminas\Mvc\Controller\Plugin\Url as UrlPlugin;
use Notification\Exception\RuntimeException;
use Notification\Factory\NotificationFactory;
use Notification\Notification;
@@ -19,14 +19,11 @@ use UnicaenApp\Exception\LogicException;
 */
class ApplicationNotificationFactory extends NotificationFactory
{
    /**
     * @var UrlHelper
     */
    protected UrlHelper $urlHelper;
    protected UrlPlugin $urlPlugin;

    public function setUrlHelper(UrlHelper $urlHelper)
    public function setUrlPlugin(UrlPlugin $urlPlugin): void
    {
        $this->urlHelper = $urlHelper;
        $this->urlPlugin = $urlPlugin;
    }

    /**
@@ -98,7 +95,7 @@ class ApplicationNotificationFactory extends NotificationFactory
            throw new RuntimeException("Aucun reset token présent pour l'utilisateur '{$utilisateur->getUsername()}' !");
        }

        $url = $this->urlHelper->__invoke(
        $url = $this->urlPlugin->fromRoute(
            'utilisateur/init-compte',
            ['token' => $token],
            ['force_canonical' => true],
+3 −4
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
namespace Application\Service\Notification;

use Interop\Container\ContainerInterface;
use Laminas\View\Helper\Url as UrlHelper;
use Notification\Factory\NotificationFactoryFactory;

/**
@@ -25,9 +24,9 @@ class ApplicationNotificationFactoryFactory extends NotificationFactoryFactory
        /** @var ApplicationNotificationFactory $factory */
        $factory = parent::__invoke($container);

        /** @var UrlHelper $urlHelper */
        $urlHelper = $container->get('ViewHelperManager')->get('Url');
        $factory->setUrlHelper($urlHelper);
        /** @var \Laminas\Mvc\Controller\Plugin\Url $urlPlugin */
        $urlPlugin = $container->get('ControllerPluginManager')->get('Url');
        $factory->setUrlPlugin($urlPlugin);

        return $factory;
    }
+9 −9
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ use Depot\Notification\ValidationRdvBuNotification;
use Depot\Rule\NotificationDepotVersionCorrigeeAttenduRule;
use Fichier\Entity\Db\VersionFichier;
use Import\Model\ImportObservResult;
use Laminas\View\Helper\Url as UrlHelper;
use Laminas\Mvc\Controller\Plugin\Url as UrlPlugin;
use Notification\Exception\RuntimeException;
use Notification\Notification;
use Structure\Service\EcoleDoctorale\EcoleDoctoraleServiceAwareTrait;
@@ -37,13 +37,13 @@ class DepotNotificationFactory extends \Notification\Factory\NotificationFactory
    use ApplicationRoleServiceAwareTrait;
    use EmailTheseServiceAwareTrait;

    protected UrlHelper $urlHelper;

    private ModuleOptions $appModuleOptions;

    public function setUrlHelper(UrlHelper $urlHelper): void
    protected UrlPlugin $urlPlugin;

    public function setUrlPlugin(UrlPlugin $urlPlugin): void
    {
        $this->urlHelper = $urlHelper;
        $this->urlPlugin = $urlPlugin;
    }

    public function setAppModuleOptions(ModuleOptions $options): void
@@ -281,9 +281,9 @@ class DepotNotificationFactory extends \Notification\Factory\NotificationFactory
     */
    public function createNotificationValidationDepotTheseCorrigee(These $these, ?Utilisateur $presidentJury = null): Notification
    {
        $targetedUrl = $this->urlHelper->__invoke( 'these/validation-these-corrigee', ['these' => $these->getId()], ['force_canonical' => true]);
        $targetedUrl = $this->urlPlugin->fromRoute( 'these/validation-these-corrigee', ['these' => $these->getId()], ['force_canonical' => true]);
        $president = $this->getApplicationRoleService()->getRepository()->findOneByCodeAndStructureConcrete(Role::CODE_PRESIDENT_JURY, $these->getEtablissement());
        $url = $this->urlHelper->__invoke('zfcuser/login', ['type' => 'local'], ['query' => ['redirect' => $targetedUrl, 'role' => $president->getRoleId()], 'force_canonical' => true], true);
        $url = $this->urlPlugin->fromRoute('zfcuser/login', ['type' => 'local'], ['query' => ['redirect' => $targetedUrl, 'role' => $president->getRoleId()], 'force_canonical' => true], true);

        // envoi de mail aux directeurs de thèse
        $notif = new ValidationDepotTheseCorrigeeNotification();
@@ -313,7 +313,7 @@ class DepotNotificationFactory extends \Notification\Factory\NotificationFactory
            ->setTemplateVariables([
                'these' => $these,
                'role' => $this->applicationRoleService->getRepository()->findOneBy(['code' => Role::CODE_PRESIDENT_JURY]),
                'url' => $this->urlHelper->__invoke('these/depot', ['these' => $these->getId()], ['force_canonical' => true]),
                'url' => $this->urlPlugin->fromRoute('these/depot', ['these' => $these->getId()], ['force_canonical' => true]),
            ]);

        $to = $this->emailTheseService->fetchEmailAspectsDoctorat($these);
@@ -348,7 +348,7 @@ class DepotNotificationFactory extends \Notification\Factory\NotificationFactory
            ->setTemplateVariables([
                'these' => $these,
                'role' => $this->applicationRoleService->getRepository()->findOneBy(['code' => Role::CODE_PRESIDENT_JURY]),
                'url' => $this->urlHelper->__invoke('these/depot', ['these' => $these->getId()], ['force_canonical' => true]),
                'url' => $this->urlPlugin->fromRoute('these/depot', ['these' => $these->getId()], ['force_canonical' => true]),
            ]);
    }

+3 −4
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@ use Application\Service\Email\EmailTheseService;
use Application\Service\Role\RoleService;
use Application\Service\Variable\VariableService;
use Interop\Container\ContainerInterface;
use Laminas\View\Helper\Url as UrlHelper;
use Notification\Factory\NotificationFactoryFactory;
use Structure\Service\EcoleDoctorale\EcoleDoctoraleService;
use Structure\Service\UniteRecherche\UniteRechercheService;
@@ -40,8 +39,9 @@ class DepotNotificationFactoryFactory extends NotificationFactoryFactory
        $ecoleDoctoraleService = $container->get('EcoleDoctoraleService');
        $uniteRechercheService = $container->get('UniteRechercheService');

        /** @var UrlHelper $urlHelper */
        $urlHelper = $container->get('ViewHelperManager')->get('Url');
        /** @var \Laminas\Mvc\Controller\Plugin\Url $urlPlugin */
        $urlPlugin = $container->get('ControllerPluginManager')->get('Url');
        $factory->setUrlPlugin($urlPlugin);

        /* @var ModuleOptions $moduleOptions */
        $moduleOptions = $container->get('unicaen-app_module_options');
@@ -49,7 +49,6 @@ class DepotNotificationFactoryFactory extends NotificationFactoryFactory
        $factory->setVariableService($variableService);
        $factory->setEcoleDoctoraleService($ecoleDoctoraleService);
        $factory->setUniteRechercheService($uniteRechercheService);
        $factory->setUrlHelper($urlHelper);
        $factory->setAppModuleOptions($moduleOptions);

        /** @var RoleService $roleService */
Loading