src/Entity/Selection.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\User;
  4. use App\Entity\Vehicle;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\SelectionRepository")
  9.  *
  10.  * @ORM\Table(name="selection")
  11.  */
  12. class Selection
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      *
  17.      * @ORM\Column(type="bigint")
  18.      *
  19.      * @ORM\GeneratedValue(strategy="AUTO")
  20.      */
  21.     protected $id;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="selections")
  24.      *
  25.      * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
  26.      */
  27.     protected $user;
  28.     /**
  29.      * @ORM\ManyToOne(targetEntity="App\Entity\Vehicle", inversedBy="selections")
  30.      *
  31.      * @ORM\JoinColumn(name="vehicle_id", referencedColumnName="id", nullable=false)
  32.      */
  33.     protected $vehicle;
  34.     /**
  35.      * @ORM\Column(name="created_at", type="datetime")
  36.      */
  37.     protected $createdAt;
  38.     public function __construct(Vehicle $vehicle)
  39.     {
  40.         $this->vehicle $vehicle;
  41.         $this->createdAt = new \DateTime('now');
  42.     }
  43.     public function getId()
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getUser()
  48.     {
  49.         return $this->user;
  50.     }
  51.     public function setUser(User $user): void
  52.     {
  53.         $this->user $user;
  54.     }
  55.     public function getVehicle()
  56.     {
  57.         return $this->vehicle;
  58.     }
  59.     public function setVehicle(Vehicle $vehicle): void
  60.     {
  61.         $this->vehicle $vehicle;
  62.     }
  63.     public function getCreatedAt()
  64.     {
  65.         return $this->createdAt;
  66.     }
  67.     public function setCreatedAt($createdAt): void
  68.     {
  69.         $this->createdAt $createdAt;
  70.     }
  71. }