<?php
namespace App\Entity;
use App\Repository\ExpertiseRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ExpertiseRepository::class)]
class Expertise
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private ?string $name = null;
#[ORM\Column(type: 'integer', nullable: true, options: ['default' => 0])]
private ?int $ordering = null;
#[ORM\Column(type: 'boolean', nullable: true, options: ['default' => 0])]
private ?bool $status = null;
#[ORM\ManyToMany(targetEntity: Offer::class, mappedBy: 'expertise')]
private Collection $offers;
public function __construct()
{
$this->offers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getOrdering(): ?int
{
return $this->ordering;
}
public function setOrdering(?int $ordering): self
{
$this->ordering = $ordering;
return $this;
}
public function getStatus(): ?bool
{
return $this->status;
}
public function setStatus(?bool $status): self
{
$this->status = $status;
return $this;
}
/**
* @return Collection<int, Offer>
*/
public function getOffers(): Collection
{
return $this->offers;
}
public function addOffer(Offer $offer): self
{
if (!$this->offers->contains($offer)) {
$this->offers[] = $offer;
$offer->addExpertise($this);
}
return $this;
}
public function removeOffer(Offer $offer): self
{
if ($this->offers->removeElement($offer)) {
$offer->removeExpertise($this);
}
return $this;
}
}