88 lines
1.8 KiB
PHP
88 lines
1.8 KiB
PHP
<?php declare(strict_types = 1);
|
|
|
|
namespace App\Model\Database\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use App\Model\Database\Entity\Attributes\TId;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
|
|
/**
|
|
* @ORM\Entity(repositoryClass="App\Model\Database\Repository\DictionaryRepository")
|
|
* @ORM\Table(name="`dictionary`")
|
|
* @ORM\HasLifecycleCallbacks
|
|
*/
|
|
class Dictionary extends AbstractEntity
|
|
{
|
|
|
|
use Tid;
|
|
|
|
public function __construct($name,$fullname)
|
|
{
|
|
$this->name = $name;
|
|
$this->fullName = $fullname;
|
|
$this->translations = new ArrayCollection();
|
|
}
|
|
|
|
/**
|
|
* @ORM\OneToMany(targetEntity="\App\Model\Database\Entity\Translation", mappedBy="dictionary", cascade={"persist"})
|
|
* @var Collection&iterable<Translation>
|
|
*/
|
|
protected Collection $translations;
|
|
|
|
public function getTranslations()
|
|
{
|
|
return $this->translations;
|
|
}
|
|
|
|
/**
|
|
* @ORM\OnetoMany(targetEntity="\App\Model\Database\Entity\Term", mappedBy="dictionary")
|
|
* @var Collection&iterable<Term>
|
|
*/
|
|
protected Collection $terms;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="Language", inversedBy="dictionaries1")
|
|
* @ORM\JoinColumn(name="lang1_id", referencedColumnName="id")
|
|
*/
|
|
protected ?Language $lang1;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="Language", inversedBy="dictionaries2")
|
|
* @ORM\JoinColumn(name="lang2_id", referencedColumnName="id")
|
|
*/
|
|
protected ?Language $lang2;
|
|
|
|
/**
|
|
* @ORM\Column(type="string")
|
|
*/
|
|
protected $name;
|
|
|
|
public function getName()
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
/**
|
|
* @ORM\Column(type="string")
|
|
*/
|
|
protected $fullName;
|
|
|
|
public function setLang1($lang1)
|
|
{
|
|
$this->lang1 = $lang1;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setLang2($lang2)
|
|
{
|
|
$this->lang2 = $lang2;
|
|
|
|
return $this;
|
|
}
|
|
|
|
}
|
|
|
|
?>
|