<?php

namespace RxConnexionBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use RxConnexionBundle\Entity\Base\BaseEntity;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\PatientEmailCcRepository")
 * @ORM\Table(name="patient_email_cc")
 */

class PatientEmailCcEntity extends BaseEntity
{

    /**
     * @ORM\Column(name="is_deleted", type="boolean")
     */
    protected $isDeleted;

    /**
     * @ORM\Column(name="email", type="string", nullable=true)
     */
    protected $email;

    /**
     * @ORM\ManyToOne(targetEntity="PatientEmailEntity", inversedBy="patientEmailCcs")
     * @ORM\JoinColumn(name="patient_email_id", referencedColumnName="id")
     */
    protected $patientEmail;


    /**
     * Set createdAt
     *
     * @ORM\PrePersist
     */
    public function setCreatedAtValue()
    {
        parent::setCreatedAtValue();
        $this->isDeleted = 0;
    }

    /*--------------------------------------------------------------------------------------------------------*/
    /*					Use Defined Setters and Getters														  */
    /*--------------------------------------------------------------------------------------------------------*/
    /**
     * Get createdAtAsString
     *
     * @return string
     * @throws \Exception
     */
    public function getCreatedAtAsString() {
        $dttst = new DateTimeToStringTransformer();
        return date('m/d/Y H:i A', strtotime($dttst->transform(new \DateTime())));
    }


    /*--------------------------------------------------------------------------------------------------------*/
    /*					Setters and Getters																	  */
    /*--------------------------------------------------------------------------------------------------------*/


    /**
     * Set isDeleted
     *
     * @param boolean $isDeleted
     *
     * @return PatientEmailCcEntity
     */
    public function setIsDeleted($isDeleted)
    {
        $this->isDeleted = $isDeleted;

        return $this;
    }

    /**
     * Get isDeleted
     *
     * @return boolean
     */
    public function getIsDeleted()
    {
        return $this->isDeleted;
    }

    /**
     * Set email
     *
     * @param string $email
     *
     * @return PatientEmailCcEntity
     */
    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }

    /**
     * Get email
     *
     * @return string
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * Set patientEmail
     *
     * @param \RxConnexionBundle\Entity\PatientEmailEntity $patientEmail
     *
     * @return PatientEmailCcEntity
     */
    public function setPatientEmail(\RxConnexionBundle\Entity\PatientEmailEntity $patientEmail = null)
    {
        $this->patientEmail = $patientEmail;

        return $this;
    }

    /**
     * Get patientEmail
     *
     * @return \RxConnexionBundle\Entity\PatientEmailEntity
     */
    public function getPatientEmail()
    {
        return $this->patientEmail;
    }
}
