public function getEmail($reference)
    {
        if (!isset($this->emails[$reference])) {
            $this->emails[$reference] = $this->em->getRepository($this->options['email_class'])->findOneByReference($reference);
        }

        $email = $this->emails[$reference];

        if (!$email instanceof EmailInterface) {
            throw new ReferenceNotFoundException($reference, sprintf('Reference "%s" does not exist for email.', $reference));
        }

        return $email;
    }
public function getEmail($reference)
    {
        if (!isset($this->emails[$reference])) {
            $this->emails[$reference] = $this->em->getRepository($this->options['email_class'])->findOneByReference($reference);
        }

        $email = $this->emails[$reference];

        if (!$email instanceof EmailInterface) {
            throw new ReferenceNotFoundException($reference, sprintf('Reference "%s" does not exist for email.', $reference));
        }

        return $email;
    }
public function getEmail ( $ reference ) { if ( ! isset ( $ this -> emails [ $ reference ] ) ) { $ this -> emails [ $ reference ] = $ this -> em -> getRepository ( $ this -> options [ 'email_class' ] ) -> findOneByReference ( $ reference ) ; } $ email = $ this -> emails [ $ reference ] ; if ( ! $ email instanceof EmailInterface ) { throw new ReferenceNotFoundException ( $ reference , sprintf ( 'Reference "%s" does not exist for email.' , $ reference ) ) ; } return $ email ; }
Find an email from database

@param  string $reference

@throws ReferenceNotFoundException

@return  EmailInterface|null
Find an email from database