PHP code example of gepur-it / email_address_type
1. Go to this page and download the library: Download gepur-it/email_address_type 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/ */
gepur-it / email_address_type example snippets
namespace YourBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as JMS;
use Symfony\Component\Validator\Constraints as Assert;
use GepurIt\EmailAddress\Email
/** Class EntityWithEmailField
* @package YourBundle\Entity
*
* @ORM\Table(
* name="your_table_name",
* options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"}
* )
* @ORM\Entity(repositoryClass="YourBundle\Repository\EntityWithEmailFieldRepository")
* @ORM\HasLifecycleCallbacks()
* @codeCoverageIgnore
*/
class EntityWithEmailField
{
/**
* @var Email
*
* @ORM\Column(name="email_address_column", type="email_address")
* @JMS\Expose()
* @JMS\Groups({"full", "Default"})
*/
private $email;
/**
* @return Email
*/
public function getEmail()
{
return $this->email;
}
/**
* @param Email $email
*/
public function setEmail(Email $email)
{
$this->email = $email;
}
}