2017 © Pedro PelĂĄez
 

library email-address-doctrine

Email address type for Doctrine.

image

nepada/email-address-doctrine

Email address type for Doctrine.

  • Sunday, July 15, 2018
  • by xificurk
  • Repository
  • 1 Watchers
  • 1 Stars
  • 63 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Email address Doctrine type

Build Status Coverage Status Downloads this Month Latest stable, (*1)

Installation

Via Composer:, (*2)

$ composer require nepada/email-address-doctrine

Register the types in your bootstrap:, (*3)

\Doctrine\DBAL\Types\Type::addType(
    \Nepada\EmailAddress\RfcEmailAddress::class,
    \Nepada\EmailAddressDoctrine\RfcEmailAddressType::class
);
\Doctrine\DBAL\Types\Type::addType(
    \Nepada\EmailAddress\CaseInsensitiveEmailAddress::class,
    \Nepada\EmailAddressDoctrine\CaseInsensitiveEmailAddressType::class
);

In Nette with nettrine/dbal integration, you can register the types in your configuration:, (*4)

dbal:
    connection:
        types:
            Nepada\EmailAddress\RfcEmailAddress: Nepada\EmailAddressDoctrine\RfcEmailAddressType
            Nepada\EmailAddress\CaseInsensitiveEmailAddress: Nepada\EmailAddressDoctrine\CaseInsensitiveEmailAddressType

Usage

This package provides two Doctrine types: 1) RfcEmailAddressType for storing emails represented by RfcEmailAddress. 2) CaseInsensitiveEmailAddressType for storing emails represented by CaseInsensitiveEmailAddress., (*5)

Both types normalize the domain part of the email address before storing it in database, but they differ in handling of the local part of the address. See nepada/email-address for further details., (*6)

Example usage in the entity:, (*7)

use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Nepada\EmailAddress\CaseInsensitiveEmailAddress;

#[Entity]
class Contact
{

    #[Column(type: CaseInsensitiveEmailAddress::class, nullable: false)]
    private CaseInsensitiveEmailAddress $email;

    public function getEmailAddress(): CaseInsensitiveEmailAddress
    {
        return $this->emailAddress;
    }

}

Example usage in query builder:, (*8)

$result = $repository->createQueryBuilder('foo')
    ->select('foo')
    ->where('foo.email = :emailAddress')
     // the parameter value is automatically normalized to example@example.com
    ->setParameter('emailAddress', 'Example@Example.com', CaseInsensitiveEmailAddress::class)
    ->getQuery()
    ->getResult();

The Versions

15/07 2018

dev-master

9999999-dev

Email address type for Doctrine.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Petr MorĂĄvek

doctrine nette value object email address

09/07 2018

v1.0.1

1.0.1.0

Email address type for Doctrine.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Petr MorĂĄvek

doctrine nette value object email address

05/06 2018

v1.0.0

1.0.0.0

Email address type for Doctrine.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Petr MorĂĄvek

doctrine nette value object email address