PHP code example of nepada / email-address-doctrine
1. Go to this page and download the library: Download nepada/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/ */
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;
}
}
$result = $repository->createQueryBuilder('foo')
->select('foo')
->where('foo.email = :emailAddress')
// the parameter value is automatically normalized to [email protected]
->setParameter('emailAddress', '[email protected]', CaseInsensitiveEmailAddress::class)
->getQuery()
->getResult();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.