<?php
namespace App\Entity;
use App\Repository\PhotoRepository;
use phpDocumentor\Reflection\Types\Integer;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass:PhotoRepository ::class)]
class Photo
{
//Déclarations des variables
#[ORM\Id]
#[ORM\Column(name: 'id_photo',type: 'integer', nullable: false)]
#[ORM\GeneratedValue(strategy:'IDENTITY')]
private ?int $id;
#[ORM\Column(length: 255, nullable: false)]
private ?string $chemin = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
//Nullable est par défaut à false, donc on le précise que quand il est true
//Association
//On ajoute la relation ManyToOne où Photo est le propriétaire (=Many), (=inversedBy)
#[ORM\ManyToOne(targetEntity: Model::class, inversedBy: 'photos')]
#[ORM\JoinColumn(referencedColumnName: 'id_model', nullable: true)]
private ?Model $model = null;
//Getters et Setters
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @param int|null $id
*/
public function setId(?int $id): void
{
$this->id = $id;
}
/**
* @return Model|null
*/
public function getModel(): ?Model
{
return $this->model;
}
/**
* @param Model|null $model
*/
public function setModel(?Model $model): void
{
$this->model = $model;
}
/**
* @return string|null
*/
public function getChemin(): ?string
{
return $this->chemin;
}
/**
* @param string|null $chemin
*/
public function setChemin(?string $chemin): void
{
$this->chemin = $chemin;
}
/**
* @return string|null
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param string|null $name
*/
public function setName(?string $name): void
{
$this->name = $name;
}
}