<?php
namespace App\Entity;
use App\Entity\Sale;
use App\Entity\User;
use App\Entity\Vehicle;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity
*
* @ORM\Table(
* name="behaviour",
* indexes={
*
* @ORM\Index(columns={"created_at"})
* }
* )
*
* @ORM\InheritanceType("SINGLE_TABLE")
*
* @ORM\DiscriminatorColumn(name="type", type="string")
*
* @ORM\DiscriminatorMap( {"sale" = "SaleBehaviour", "vehicle" = "VehicleBehaviour"} )
*/
abstract class Behaviour
{
/**
* @ORM\Id
*
* @ORM\Column(type="bigint")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="behaviours")
*
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
protected $user;
/**
* @ORM\Column(type="integer")
*/
protected $value = 1;
/**
* @ORM\Column(type="datetime", name="created_at")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", name="updated_at")
*/
private $updatedAt;
public function __construct(User $user)
{
$this->user = $user;
$this->createdAt = new \DateTime();
$this->updatedAt = new \DateTime();
}
/**
* Returns id.
*/
public function getId()
{
return $this->id;
}
/**
* Returns user.
*
* @return App\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* Sets user.
*
* @param App\Entity\User $user
*/
public function setUser(?User $user = null): void
{
$this->user = $user;
}
/**
* Return creation date.
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set creation date.
*/
public function setCreatedAt(\DateTime $createdAt): void
{
$this->createdAt = $createdAt;
}
/**
* Return last updated date.
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set updated date.
*/
public function setUpdatedAt(\DateTime $updatedAt): void
{
$this->updatedAt = $updatedAt;
}
/**
* Get value.
*
* @return string $value
*/
public function getValue()
{
return $this->value;
}
/**
* Set value.
*
* @param string value
*/
public function setValue($value): void
{
$this->value = $value;
}
}