<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Organism
*
* @ORM\Table(name="organism")
* @ORM\Entity
*/
class Organism
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255, nullable=false)
*/
private $name;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\ManyToMany(targetEntity="Expert", mappedBy="organism")
*/
private $expert;
/**
* Constructor
*/
public function __construct()
{
$this->expert = new \Doctrine\Common\Collections\ArrayCollection();
}
public function __toString() { return $this->name;}
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;
}
/**
* @return Collection<int, Expert>
*/
public function getExpert(): Collection
{
return $this->expert;
}
public function addExpert(Expert $expert): self
{
if (!$this->expert->contains($expert)) {
$this->expert[] = $expert;
$expert->addOrganism($this);
}
return $this;
}
public function removeExpert(Expert $expert): self
{
if ($this->expert->removeElement($expert)) {
$expert->removeOrganism($this);
}
return $this;
}
}