Commit cdedf8dc authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

UP : Uniformisation de la récupération de l'authentification (mailPersonsWithUnreadNotification)

parent 0cf550d2
Loading
Loading
Loading
Loading
Loading
+1 −4
Changes for module/Oscar/src/Oscar/Command/OscarNotificationsMailsPersonsCommand.php: 1 added line, 4 removed lines.
Original line number Diff line number Diff line
@@ -26,12 +26,9 @@ class OscarNotificationsMailsPersonsCommand extends OscarCommandAbstract
    {
        $this->addOutputStyle($output);

        /** @var OscarUserContext $oscaruserContext */
        $oscaruserContext = $this->getServicemanager()->get(OscarUserContext::class);

        $io = new SymfonyStyle($input, $output);

        /** @var PersonService $oscarConfig */
        /** @var PersonService $personService */
        $personService = $this->getServicemanager()->get(PersonService::class);

        $personService->mailPersonsWithUnreadNotification(null, $io);
+1 −1
Changes for module/Oscar/src/Oscar/Service/OscarUserContext.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -318,7 +318,7 @@ class OscarUserContext implements UseOscarConfigurationService, UseLoggerService
    public function getAuthentification()
    {
        if ($this->getUserContext()->getDbUser()) {
            return $this->getEntityManager()->getRepository(Authentification::class)->find($this->getDbUser()->getId());
            return $this->getAuthentificationRepository()->find($this->getDbUser()->getId());
        }
        return null;
    }
+7 −4
Changes for module/Oscar/src/Oscar/Service/PersonService.php: 7 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -486,9 +486,6 @@ class PersonService implements UseOscarConfigurationService, UseEntityManager, U

        $authPersonNormalize = $this->getOscarConfigurationService()->getAuthPersonNormalize();

        /** @var AuthentificationRepository $authentificationRepository */
        $authentificationRepository = $this->getEntityManager()->getRepository(Authentification::class);

        // Liste des personnes ayant des notifications non-lues
        $persons = $this->getPersonRepository()->getPersonsWithUnreadNotificationsAndAuthentification($authPersonNormalize);

@@ -498,7 +495,7 @@ class PersonService implements UseOscarConfigurationService, UseEntityManager, U
        foreach ($persons as $person) {
            try {
                /** @var Authentification $auth */
                $auth = $authentificationRepository->getAuthentificationPerson($person, $authPersonNormalize);
                $auth = $this->getPersonAuthentification($person);
                $settings = $auth->getSettings();

                if (!$settings) {
@@ -1924,11 +1921,17 @@ class PersonService implements UseOscarConfigurationService, UseEntityManager, U
        return $this->getEntityManager()->getRepository(Authentification::class);
    }

    /**
     * @return OrganizationRepository
     */
    public function getOrganizationRepository()
    {
        return $this->getEntityManager()->getRepository(Organization::class);
    }

    /**
     * @return RoleRepository
     */
    public function getRoleRepository(): RoleRepository
    {
        return $this->getEntityManager()->getRepository(Role::class);