<?php
namespace App\Entity;
use App\Repository\AvisRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=AvisRepository::class)
*/
class Avis
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="float")
*
* @Assert\NotBlank(message="Veuillez noter la qualité du service")
*/
private $serviceQuality;
/**
* @ORM\Column(type="float")
*
* @Assert\NotBlank(message="Veuillez noter la fiabilité du prestataire")
*/
private $fiability;
/**
* @ORM\Column(type="float")
*
* @Assert\NotBlank(message="Veuillez noter le prix du produit")
*/
private $price;
/**
* @ORM\Column(type="float")
*
* @Assert\NotBlank(message="Veuillez noter la rapidité de la livraison")
*/
private $speed;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $text;
/**
* @ORM\Column(type="float")
*
* @Assert\NotBlank(message="Veuillez noter la conformité du produit")
*/
private $conformDescription;
/**
* @ORM\Column(type="float")
*
* @Assert\NotBlank(message="Veuillez noter la communication du prestataire")
*/
private $communication;
/**
* @ORM\ManyToOne(targetEntity=Product::class, inversedBy="avis")
*/
private $product;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="avis")
*/
private $client;
/**
* @ORM\Column(type="float")
*/
private $globalNote;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $createdAt;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $responseCompany;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isDesactivatedByAdmin;
/**
* @ORM\OneToMany(targetEntity=ImageComment::class, mappedBy="avis")
*/
private $imageComments;
public function __construct()
{
$this->createdAt = new \DateTime();
$this->imageComments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getServiceQuality(): ?float
{
return $this->serviceQuality;
}
public function setServiceQuality(float $serviceQuality): self
{
$this->serviceQuality = $serviceQuality;
return $this;
}
public function getFiability(): ?float
{
return $this->fiability;
}
public function setFiability(float $fiability): self
{
$this->fiability = $fiability;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(float $price): self
{
$this->price = $price;
return $this;
}
public function getSpeed(): ?float
{
return $this->speed;
}
public function setSpeed(float $speed): self
{
$this->speed = $speed;
return $this;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function getConformDescription(): ?float
{
return $this->conformDescription;
}
public function setConformDescription(float $conformDescription): self
{
$this->conformDescription = $conformDescription;
return $this;
}
public function getCommunication(): ?float
{
return $this->communication;
}
public function setCommunication(float $communication): self
{
$this->communication = $communication;
return $this;
}
public function getProduct(): ?Product
{
return $this->product;
}
public function setProduct(?Product $product): self
{
$this->product = $product;
return $this;
}
public function getClient(): ?User
{
return $this->client;
}
public function setClient(?User $client): self
{
$this->client = $client;
return $this;
}
public function getGlobalNote(): ?float
{
return $this->globalNote;
}
public function setGlobalNote(float $globalNote): self
{
$this->globalNote = $globalNote;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getResponseCompany(): ?string
{
return $this->responseCompany;
}
public function setResponseCompany(?string $responseCompany): self
{
$this->responseCompany = $responseCompany;
return $this;
}
public function getIsDesactivatedByAdmin(): ?bool
{
return $this->isDesactivatedByAdmin;
}
public function setIsDesactivatedByAdmin(?bool $isDesactivatedByAdmin): self
{
$this->isDesactivatedByAdmin = $isDesactivatedByAdmin;
return $this;
}
/**
* @return Collection|ImageComment[]
*/
public function getImageComments(): Collection
{
return $this->imageComments;
}
public function addImageComment(ImageComment $imageComment): self
{
if (!$this->imageComments->contains($imageComment)) {
$this->imageComments[] = $imageComment;
$imageComment->setAvis($this);
}
return $this;
}
public function removeImageComment(ImageComment $imageComment): self
{
if ($this->imageComments->removeElement($imageComment)) {
// set the owning side to null (unless already changed)
if ($imageComment->getAvis() === $this) {
$imageComment->setAvis(null);
}
}
return $this;
}
}