<?php


namespace App\Model\Entities\Security;

use DateTime;
use Doctrine\ORM\Mapping as ORM;
use App\Model\Entities\BaseEntity;

/**
 * @ORM\MappedSuperclass
 */
abstract class BaseAuthenticationEntity extends BaseEntity
{
    /**
     * @var User
     * @ORM\OneToOne(targetEntity="User")
     */
    protected $user;

    /**
     * @var DateTime
     * @ORM\Column(type="datetime")
     */
    protected $createdAt;

    public function __construct()
    {
        $this->createdAt = new DateTime();
    }

    /**
     * @return DateTime
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /**
     * @return User
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * @param User $user
     */
    public function setUser($user)
    {
        $this->user = $user;
    }
}