src/Controller/Plugin/InvitationHandler.php
public function process($email)
    {
        $translator = $this->getTranslator();

        if (!$this->validateEmail($email)) {
            return array(
                'ok'      => false,
                'message' => $translator->translate('Email address is invalid.')
            );
        }

        $userAndToken = $this->loadOrCreateUser($email);

        try {
            $mailer = $this->getMailerPlugin();
            $mailer('Organizations/InviteEmployee', $userAndToken, true);
        } catch (\Exception $e) {
            return array(
                'ok'      => false,
                'message' => $translator->translate(trim('Sending invitation mail failed. '.$e->getMessage()))
            );
        }

        $user = $userAndToken['user'];

        /* @var $user \Auth\Entity\User
         * @var $info \Auth\Entity\InfoInterface
         */

        $info = $user->getInfo();

        return array(
            'ok'     => true,
            'result' => array(
                'userId'    => $user->getId(),
                'userName'  => $info->getDisplayName(),
                'userEmail' => $email
            )
        );
    }
public function process($email)
    {
        $translator = $this->getTranslator();

        if (!$this->validateEmail($email)) {
            return array(
                'ok'      => false,
                'message' => $translator->translate('Email address is invalid.')
            );
        }

        $userAndToken = $this->loadOrCreateUser($email);

        try {
            $mailer = $this->getMailerPlugin();
            $mailer('Organizations/InviteEmployee', $userAndToken, true);
        } catch (\Exception $e) {
            return array(
                'ok'      => false,
                'message' => $translator->translate(trim('Sending invitation mail failed. '.$e->getMessage()))
            );
        }

        $user = $userAndToken['user'];

        /* @var $user \Auth\Entity\User
         * @var $info \Auth\Entity\InfoInterface
         */

        $info = $user->getInfo();

        return array(
            'ok'     => true,
            'result' => array(
                'userId'    => $user->getId(),
                'userName'  => $info->getDisplayName(),
                'userEmail' => $email
            )
        );
    }
Processes the invitation of an user by an organization owner.

Validators the email address, loads or creates the user and finallly sends
the mail.

The return value is meant to be used as an array of variables passed to a
ViewModelInterface instance.

@param string $email

@return array