/
Locale.php
133 lines (117 loc) · 2.68 KB
/
Locale.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
namespace Concrete\Core\Entity\Site;
use Concrete\Core\Entity\LocaleTrait;
use Concrete\Core\Localization\Locale\LocaleInterface;
use Concrete\Core\Site\Tree\TreeInterface;
use Doctrine\ORM\Mapping as ORM;
/**
* Represents a site locale.
*
* @ORM\Entity
* @ORM\Table(name="SiteLocales")
*/
class Locale implements LocaleInterface, TreeInterface
{
use LocaleTrait;
/**
* @ORM\Id @ORM\Column(type="integer", options={"unsigned":true})
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $siteLocaleID;
/**
* @ORM\ManyToOne(targetEntity="Site", inversedBy="locales")
* @ORM\JoinColumn(name="siteID", referencedColumnName="siteID")
**/
protected $site;
/**
* @ORM\OneToOne(targetEntity="SiteTree", cascade={"all"}, mappedBy="locale")
* @ORM\JoinColumn(name="siteTreeID", referencedColumnName="siteTreeID")
**/
protected $tree;
/**
* @ORM\Column(type="boolean")
*/
public $msIsDefault = false;
/**
* Get the site locale record identifier (or NULL if the record has not been saved yet).
*
* @return int|null
*/
public function getLocaleID()
{
return $this->siteLocaleID;
}
/**
* Is this the default locale?
*
* @return bool
*/
public function getIsDefault()
{
return $this->msIsDefault;
}
/**
* Is this the default locale?
*
* @param bool $msIsDefault
*/
public function setIsDefault($msIsDefault)
{
$this->msIsDefault = (bool) $msIsDefault;
}
/**
* Get the site associated to this locale.
*
* @return Site|null
*/
public function getSite()
{
return $this->site;
}
/**
* Set the site associated to this locale.
*
* @param Site|null $site
*/
public function setSite(Site $site = null)
{
$this->site = $site;
}
/**
* Get the site tree associated to this locale.
*
* @return SiteTree|null
*/
public function getSiteTree()
{
return $this->tree;
}
/**
* Set the site tree associated to this locale.
*
* @param SiteTree|null $tree
*/
public function setSiteTree(SiteTree $tree = null)
{
$this->tree = $tree;
}
/**
* {@inheritdoc}
*
* @see TreeInterface::getSiteTreeID()
*/
public function getSiteTreeID()
{
$tree = $this->getSiteTree();
return $tree === null ? null : $tree->getSiteTreeID();
}
/**
* {@inheritdoc}
*
* @see TreeInterface::getSiteTreeObject()
*/
public function getSiteTreeObject()
{
return $this->getSiteTree();
}
}