<?php

namespace Neag\MainBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * UserSession
 *
 * @ORM\Table(name="user_session", indexes={@ORM\Index(name="session_id_idx", columns={"session_id"}), @ORM\Index(name="time_expire_idx", columns={"time_expire"})})
 * @ORM\Entity
 */
class UserSession
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="bigint", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="session_id", type="string", length=255, nullable=false)
     */
    private $sessionId;
    
    /**
     * @var integer
     * 
     * @var \Neag\MainBundle\Entity\User
     * @ORM\ManyToOne(targetEntity="User")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") 
     */ 
    private $user;
    
    /**
     * @var \DateTime
     *
     * @ORM\Column(name="time_expire", type="datetime", nullable=true)
     */
    private $timeExpire;    


    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set sessionId
     *
     * @param string $sessionId
     * @return UserSession
     */
    public function setSessionId($sessionId)
    {
        $this->sessionId = $sessionId;

        return $this;
    }

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

    /**
     * Set user
     *
     * @param \Neag\MainBundle\Entity\User $user
     * @return UserSession
     */
    public function setUser(\Neag\MainBundle\Entity\User $user = null)
    {
        $this->user = $user;

        return $this;
    }

    /**
     * Get user
     *
     * @return \Neag\MainBundle\Entity\User 
     */
    public function getUser()
    {
        return $this->user;
    }
    
    /**
     * Set timeExpire
     *
     * @param string $timeExpire
     * @return UserSession
     */
    public function setTimeExpire($timeExpire)
    {
        $this->timeExpire = $timeExpire;

        return $this;
    }

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