Ojs\AdminBundle\EventListener\AdminEventListener::onJournalApplicationHappen PHP Method

onJournalApplicationHappen() public method

public onJournalApplicationHappen ( AdminEvent $event )
$event Ojs\AdminBundle\Events\AdminEvent
    public function onJournalApplicationHappen(AdminEvent $event)
    {
        /** @var Journal $journal */
        $journal = $event->getEntity();
        $getMailEvent = $this->ojsMailer->getEventByName(AdminEvents::JOURNAL_APPLICATION_HAPPEN);
        if (!$getMailEvent) {
            goto lookforapplicationuser;
        }
        //send to admin user group
        foreach ($this->ojsMailer->getAdminUsers() as $user) {
            $transformParams = ['journal.title' => $journal->getTitle(), 'receiver.username' => $user->getUsername(), 'receiver.fullName' => $user->getFullName()];
            $template = $this->ojsMailer->transformTemplate($getMailEvent->getTemplate(), $transformParams);
            $this->ojsMailer->sendToUser($user, $getMailEvent->getSubject(), $template);
        }
        lookforapplicationuser:
        //send to applier user
        $getMailEvent = $this->ojsMailer->getEventByName(AdminEvents::JOURNAL_APPLICATION_HAPPEN . '.application.user');
        if (!$getMailEvent) {
            return;
        }
        $transformParams = ['journal.title' => $journal->getTitle(), 'journal.phone' => $journal->getPhone(), 'journal.address' => $journal->getAddress()];
        if ($this->ojsMailer->currentUser() instanceof UserInterface) {
            $user = $this->ojsMailer->currentUser();
        } else {
            $user = new User();
            $user->setEmail($journal->getEmail())->setUsername($this->ojsMailer->translator->trans('journal.manager'));
        }
        $template = $this->ojsMailer->transformTemplate($getMailEvent->getTemplate(), $transformParams);
        $this->ojsMailer->sendToUser($user, $getMailEvent->getSubject(), $template);
    }