<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @ORM\Table(name="fs_help")
* @ORM\Entity
*/
class Help
{
function helpLocale($locale){
foreach($this->translations as $trans){
if($trans->getLanguage()->getSign() == $locale)
return $trans;
}
}
/**
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="slug", type="string")
*/
protected $slug;
// ONE TO MANY
/**
* @ORM\OneToMany(targetEntity="App\Entity\HelpTranslation", mappedBy="help")
*/
private $translations;
//
public function __construct()
{
$this->translations = new ArrayCollection();
}
public function getId(): ?string
{
return $this->id;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
/**
* @return Collection<int, HelpTranslation>
*/
public function getTranslations(): Collection
{
return $this->translations;
}
public function addTranslation(HelpTranslation $translation): self
{
if (!$this->translations->contains($translation)) {
$this->translations->add($translation);
$translation->setHelp($this);
}
return $this;
}
public function removeTranslation(HelpTranslation $translation): self
{
if ($this->translations->removeElement($translation)) {
// set the owning side to null (unless already changed)
if ($translation->getHelp() === $this) {
$translation->setHelp(null);
}
}
return $this;
}
}