This commit is contained in:
2022-01-16 22:48:42 +01:00
parent 1ead7f5741
commit c801608fe8
3 changed files with 21 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types = 1);
namespace App\Model\Database\Entity;
@@ -8,7 +8,9 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* @ORM\Entity
* @ORM\Entity(repositoryClass="App\Model\Database\Repository\DictionaryRepository")
* @ORM\Table(name="`dictionary`")
* @ORM\HasLifecycleCallbacks
*/
class Dictionary extends AbstractEntity
{
@@ -23,7 +25,7 @@ class Dictionary extends AbstractEntity
}
/**
* @ORM\OneToMany(targetEntity="App\Model\Database\Entity\Translation", mappedBy="dictionary", cascade={"persist"})
* @ORM\OneToMany(targetEntity="\App\Model\Database\Entity\Translation", mappedBy="dictionary", cascade={"persist"})
* @var Collection&iterable<Translation>
*/
protected Collection $translations;
@@ -35,13 +37,13 @@ class Dictionary extends AbstractEntity
/**
* @ORM\ManyToOne(targetEntity="Language", inversedBy="dictionaries1")
* @ORM\ManyToOne(targetEntity="\App\Model\Database\Entity\Language", inversedBy="dictionaries1")
* @ORM\JoinColumn(name="lang1_id", referencedColumnName="id")
*/
protected ?Language $lang1;
/**
* @ORM\ManyToOne(targetEntity="Language", inversedBy="dictionaries2")
* @ORM\ManyToOne(targetEntity="\App\Model\Database\Entity\Language", inversedBy="dictionaries2")
* @ORM\JoinColumn(name="lang2_id", referencedColumnName="id")
*/
protected ?Language $lang2;

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types = 1);
namespace App\Model\Database\Entity;
@@ -42,13 +42,13 @@ class Language extends AbstractEntity
/*
* @var Collection&iterable<Dictionary>
* @ORM\OneToMany(targetEntity="Dictionary", mappedBy="language")
* @ORM\OneToMany(targetEntity="\App\Model\Database\Entity\Dictionary", mappedBy="language")
*/
protected Collection $dictionaries1;
/*
* @var Collection&iterable<Dictionary>
* @ORM\OneToMany(targetEntity="Dictionary", mappedBy="language")
* @ORM\OneToMany(targetEntity="\App\Model\Database\Entity\Dictionary", mappedBy="language")
*/
protected Collection $dictionaries2;

View File

@@ -1,4 +1,5 @@
<?php
<?php declare(strict_types = 1);
namespace App\Model\Database\Entity;
@@ -6,7 +7,9 @@ use Doctrine\ORM\Mapping as ORM;
use App\Model\Database\Entity\Attributes\TId;
/**
* @ORM\Entity
* @ORM\Entity(repositoryClass="App\Model\Database\Repository\TermRepository")
* @ORM\Table(name="`translation`")
* @ORM\HasLifecycleCallbacks
*/
class Translation extends AbstractEntity
{
@@ -24,7 +27,7 @@ class Translation extends AbstractEntity
}
/**
* @ORM\ManyToOne(targetEntity="Dictionary", inversedBy="translations")
* @ORM\ManyToOne(targetEntity="App\Model\Database\Entity\Dictionary", inversedBy="translations")
*/
protected $dictionary;
@@ -34,12 +37,12 @@ class Translation extends AbstractEntity
}
/**
* @ORM\ManyToOne(targetEntity="Language", inversedBy="translations1")
* @ORM\ManyToOne(targetEntity="App\Model\Database\Entity\Language", inversedBy="translations1")
*/
protected $lang1;
/**
* @ORM\ManyToOne(targetEntity="Language", inversedBy="translations2")
* @ORM\ManyToOne(targetEntity="App\Model\Database\Entity\Language", inversedBy="translations2")
*/
protected $lang2;
@@ -48,16 +51,17 @@ class Translation extends AbstractEntity
*/
protected $lang_name1;
public function getLangName1()
public function getLangName1(): String
{
return $this->lang_name1;
}
/**
* @ORM\Column(type="string")
*/
protected $lang_name2;
public function getLangName2()
public function getLangName2(): String
{
return $this->lang_name2;
}