|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Veslo project <https://github.com/symfony-doge/veslo>. |
|
5
|
|
|
* |
|
6
|
|
|
* (C) 2019 Pavel Petrov <[email protected]>. |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
* |
|
11
|
|
|
* @license https://opensource.org/licenses/GPL-3.0 GPL-3.0 |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
declare(strict_types=1); |
|
15
|
|
|
|
|
16
|
|
|
namespace Veslo\SanityBundle\Entity\Vacancy\Tag\Group\Translation; |
|
17
|
|
|
|
|
18
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
19
|
|
|
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation; |
|
20
|
|
|
use Veslo\SanityBundle\Entity\Vacancy\Tag\Group; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Translation entry for a field of sanity group entity |
|
24
|
|
|
* |
|
25
|
|
|
* Note: personal translation is chosen because this data is received from external source, |
|
26
|
|
|
* so each time we perform sync, old translation entries have to be deleted (cascade) |
|
27
|
|
|
* |
|
28
|
|
|
* @ORM\Table( |
|
29
|
|
|
* name="sanity_vacancy_tag_group_translation", |
|
30
|
|
|
* uniqueConstraints={ |
|
31
|
|
|
* @ORM\UniqueConstraint( |
|
32
|
|
|
* name="sanity_vacancy_tag_group_translation_locale_object_id_field_uq", |
|
33
|
|
|
* columns={"locale", "object_id", "field"} |
|
34
|
|
|
* ) |
|
35
|
|
|
* } |
|
36
|
|
|
* ) |
|
37
|
|
|
* @ORM\Entity(repositoryClass="Gedmo\Translatable\Entity\Repository\TranslationRepository", readOnly=true) |
|
38
|
|
|
* @ORM\Cache(usage="READ_ONLY", region="index") |
|
39
|
|
|
*/ |
|
40
|
|
|
class Entry extends AbstractPersonalTranslation |
|
41
|
|
|
{ |
|
42
|
|
|
/** |
|
43
|
|
|
* Translatable entity |
|
44
|
|
|
* |
|
45
|
|
|
* @var Group |
|
46
|
|
|
* |
|
47
|
|
|
* @ORM\ManyToOne(targetEntity="Veslo\SanityBundle\Entity\Vacancy\Tag\Group", inversedBy="translations") |
|
48
|
|
|
* @ORM\JoinColumn(name="object_id", referencedColumnName="id", onDelete="CASCADE") |
|
49
|
|
|
*/ |
|
50
|
|
|
protected $object; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* {@inheritdoc} |
|
54
|
|
|
* |
|
55
|
|
|
* @var Group $object Group for sanity tags |
|
56
|
|
|
*/ |
|
57
|
|
|
public function setObject($object) |
|
58
|
|
|
{ |
|
59
|
|
|
parent::setObject($object); |
|
60
|
|
|
|
|
61
|
|
|
$object->addTranslation($this); |
|
62
|
|
|
|
|
63
|
|
|
return $this; |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|