<?php
namespace App\Entity;
use App\Repository\GenericRecommendationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Overblog\GraphQLBundle\Annotation\Field;
#[ORM\Entity(repositoryClass: GenericRecommendationRepository::class)]
class GenericRecommendation extends Recommendation
{
#[ORM\Column(type: Types::TEXT, nullable: true)]
#[Field(name: "action", type: "string")]
protected ?string $action = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
#[Field(name: "benefit", type: "string")]
protected ?string $benefit = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
#[Field(name: "domain_id", type: "integer")]
protected ?int $domain_id = null;
#[ORM\ManyToMany(targetEntity: Domain::class, mappedBy: 'implementedGenericRecommendations')]
private Collection $domains;
public function __construct()
{
$this->domains = new ArrayCollection();
}
public function getAction(): ?string
{
return $this->action;
}
public function setAction(?string $action): self
{
$this->action = $action;
return $this;
}
public function getBenefit(): ?string
{
return $this->benefit;
}
public function setBenefit(?string $benefit): self
{
$this->benefit = $benefit;
return $this;
}
/**
* @return Collection<int, Domain>
*/
public function getDomains(): Collection
{
return $this->domains;
}
public function addDomain(Domain $domain): static
{
if (!$this->domains->contains($domain)) {
$this->domains->add($domain);
$domain->addImplementedGenericRecommendation($this);
}
return $this;
}
public function removeDomain(Domain $domain): static
{
if ($this->domains->removeElement($domain)) {
$domain->removeImplementedGenericRecommendation($this);
}
return $this;
}
}