PHP code example of nordic / email-address-doctrine
1. Go to this page and download the library: Download nordic/email-address-doctrine library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nordic / email-address-doctrine example snippets
use Doctrine\DBAL\Types\Type;
use Nordic\EmailAddress\Doctrine\EmailAddressType;
Type::addType(EmailAddressType::EMAIL_ADDRESS, EmailAddressType::CLASS);
// or
Type::addType('email_address', 'Nordic\EmailAddress\Doctrine\EmailAddressType');
use Doctrine\ORM\Mapping as ORM;
use Nordic\EmailAddress\EmailAddressInterface;
/**
* @ORM\Entity
* @ORM\Table(name="contacts")
*/
class Contact
{
/**
* @ORM\Column(type="email_address")
* @var EmailAddressInterface
*/
private $emailAddress;
public function getEmailAddress(): EmailAddressInterface
{
return $this->emailAddress;
}
}