<?php
namespace App\Entity;
use App\Entity\User;
use App\Entity\Vehicle;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\SmsAlertRepository")
*
* @ORM\Table(name="sms_alert")
*/
class SmsAlert
{
/**
* @ORM\Id
*
* @ORM\Column(type="bigint")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="smsAlerts")
*
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*/
protected $user;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Vehicle", inversedBy="smsAlerts")
*
* @ORM\JoinColumn(name="vehicle_id", referencedColumnName="id", nullable=false)
*/
protected $vehicle;
/**
* @ORM\Column(name="created_at", type="datetime")
*/
protected $createdAt;
public function __construct(Vehicle $vehicle)
{
$this->vehicle = $vehicle;
$this->createdAt = new \DateTime('now');
}
public function getId()
{
return $this->id;
}
public function getUser()
{
return $this->user;
}
public function setUser(User $user): void
{
$this->user = $user;
}
public function getVehicle()
{
return $this->vehicle;
}
public function setVehicle(Vehicle $vehicle): void
{
$this->vehicle = $vehicle;
}
public function getCreatedAt()
{
return $this->createdAt;
}
public function setCreatedAt($createdAt): void
{
$this->createdAt = $createdAt;
}
}