CoolCMS API

Region extends BaseEntity
in package
implements TreeNodeInterface, IdentifiableInterface uses AssetPathTrait, IdentifiableTrait, TranslationCollectionTrait

AbstractYes

Region is a nested-set tree (`parent_id` + `lft`/`rgt`/`level`), hence the {@see TreeNodeInterface} marker: without it the generic insert gate in {@see \App\Core\Traits\Api\Models\Managers\SaveTrait} did not run and a new region stayed at `lft=0, rgt=0`. The region manager, service, mapper and repository have the tree traits, so the gate has something to call.

Tags
template
Attributes
#[MappedSuperclass]
#[TableAlias]
$alias: 'region'

Table of Contents

Interfaces

TreeNodeInterface
Marker for an entity ordered as a nested set (tree via lft/rgt/level + parentId).
IdentifiableInterface
Entity with a simple integer primary key. Most entities have one (often via {@see \App\Core\Traits\Shared\Models\Entities\IdentifiableTrait}); texts and links with a composite key do not, which is why `getId()` is not on {@see \App\Core\Base\BaseEntity}. Code that needs the id of a generic entity asks for this interface (parameter type, template bound, `instanceof`).

Properties

$active  : bool
$assetPath  : string|null
$countryCode  : string|null
$geonameId  : int|null
$iconClass  : string|null
$id  : int|null
$imageId  : int|null
$isCountry  : bool
$key  : string|null
$latitude  : string|null
$level  : int
$lft  : int
$longitude  : string|null
$main  : bool
$nameAscii  : string|null
$officialCode  : string|null
$parentId  : int|null
$population  : int|null
$postcode  : string|null
$rgt  : int
$suggestWeight  : int
$translations  : Collection<int, TTranslation>
$type  : string|null
$assetFile  : FtpAsset|null
Transient cache of the derived `FtpAsset` (not a database column).

Methods

__construct()  : mixed
addTranslation()  : $this
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getActive()  : bool
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getAssetFile()  : FtpAsset|null
Returns the `FtpAsset` derived from the path (lazy, works after Doctrine hydration too).
getAssetPath()  : string|null
getCountryCode()  : string|null
getGeonameId()  : int|null
getIconClass()  : string|null
getId()  : int|null
getImageId()  : int|null
getIsCountry()  : bool
getKey()  : string|null
getLatitude()  : string|null
getLevel()  : int
getLft()  : int
getLongitude()  : string|null
getMain()  : bool
getNameAscii()  : string|null
getOfficialCode()  : string|null
getParentId()  : int|null
getPopulation()  : int|null
getPostcode()  : string|null
getRgt()  : int
getSuggestWeight()  : int
getTranslation()  : TTranslation|null
getTranslations()  : Collection<int, TTranslation>
getType()  : string|null
isActive()  : bool
isCountry()  : bool
isMain()  : bool
isPersisted()  : bool
removeTranslation()  : $this
setActive()  : $this
setAssetPath()  : $this
setCountryCode()  : static
setGeonameId()  : static
setIconClass()  : $this
setId()  : $this
setImageId()  : $this
setIsCountry()  : $this
setKey()  : $this
setLatitude()  : $this
setLevel()  : $this
setLft()  : $this
setLongitude()  : $this
setMain()  : $this
setNameAscii()  : static
setOfficialCode()  : static
setParentId()  : $this
setPopulation()  : static
setPostcode()  : $this
setRgt()  : $this
setSuggestWeight()  : static
setTranslations()  : $this
setType()  : static
translationCollectionInit()  : void
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$active

protected bool $active = true
Attributes
#[Column]
$name: 'active'
$type: 'boolean'

$assetPath

protected string|null $assetPath = null
Attributes
#[Column]
$name: 'asset_path'
$type: 'string'
$length: 255
$nullable: true

$countryCode

protected string|null $countryCode = null
Attributes
#[Column]
$name: 'country_code'
$type: 'string'
$length: 2
$nullable: true
$options: ['fixed' => true]

$geonameId

protected int|null $geonameId = null
Attributes
#[Column]
$name: 'geoname_id'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

$iconClass

protected string|null $iconClass = null
Attributes
#[Column]
$name: 'icon_class'
$type: 'string'
$length: 50
$nullable: true

$id

protected int|null $id = null
Attributes
#[Column]
$name: 'region_id'
$type: 'integer'
$options: ['unsigned' => true]
#[GeneratedValue]
#[Id]

$imageId

protected int|null $imageId = null
Attributes
#[Column]
$name: 'cms_system_images_image_id'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

$isCountry

protected bool $isCountry = false
Attributes
#[Column]
$name: 'is_country'
$type: 'boolean'

$key

protected string|null $key = null
Attributes
#[Column]
$name: '`key`'
$type: 'string'
$length: 5
$nullable: true

$latitude

protected string|null $latitude = null
Attributes
#[Column]
$name: 'latitude'
$type: 'decimal'
$precision: 9
$scale: 6
$nullable: true

$level

protected int $level = 1
Attributes
#[Column]
$name: 'level'
$type: 'integer'
$options: ['unsigned' => true]

$lft

protected int $lft = 0
Attributes
#[Column]
$name: 'lft'
$type: 'integer'
$options: ['unsigned' => true]

$longitude

protected string|null $longitude = null
Attributes
#[Column]
$name: 'longitude'
$type: 'decimal'
$precision: 9
$scale: 6
$nullable: true

$main

protected bool $main = false
Attributes
#[Column]
$name: 'main'
$type: 'boolean'

$nameAscii

protected string|null $nameAscii = null
Attributes
#[Column]
$name: 'name_ascii'
$type: 'string'
$length: 200
$nullable: true

$officialCode

protected string|null $officialCode = null
Attributes
#[Column]
$name: 'official_code'
$type: 'string'
$length: 20
$nullable: true

$parentId

protected int|null $parentId = null
Attributes
#[Column]
$name: 'parent_id'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

$population

protected int|null $population = null
Attributes
#[Column]
$name: 'population'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

$postcode

protected string|null $postcode = null
Attributes
#[Column]
$name: 'postcode'
$type: 'string'
$length: 20
$nullable: true

$rgt

protected int $rgt = 0
Attributes
#[Column]
$name: 'rgt'
$type: 'integer'
$options: ['unsigned' => true]

$suggestWeight

protected int $suggestWeight = 0
Attributes
#[Column]
$name: 'suggest_weight'
$type: 'integer'
$options: ['unsigned' => true, 'default' => 0]

$translations

protected Collection<int, TTranslation> $translations = new ArrayCollection()

$type

protected string|null $type = null
Attributes
#[Column]
$name: 'type'
$type: 'string'
$length: 20
$nullable: true

Methods

__construct()

public __construct([int|null $id = null ][, bool $isCountry = false ][, string|null $key = null ][, string|null $countryCode = null ][, string|null $type = null ][, int|null $geonameId = null ][, string|null $officialCode = null ][, string|null $nameAscii = null ][, int|null $population = null ][, int $suggestWeight = 0 ][, bool $main = false ][, bool $active = true ][, int|null $parentId = null ][, int $level = 1 ][, int $lft = 0 ][, int $rgt = 0 ][, string|null $iconClass = null ][, int|null $imageId = null ][, string|null $assetPath = null ][, string|null $postcode = null ][, string|null $latitude = null ][, string|null $longitude = null ][, Collection $translations = new ArrayCollection() ]) : mixed
Parameters
$id : int|null = null
$isCountry : bool = false
$key : string|null = null
$countryCode : string|null = null
$type : string|null = null
$geonameId : int|null = null
$officialCode : string|null = null
$nameAscii : string|null = null
$population : int|null = null
$suggestWeight : int = 0
$main : bool = false
$active : bool = true
$parentId : int|null = null
$level : int = 1
$lft : int = 0
$rgt : int = 0
$iconClass : string|null = null
$imageId : int|null = null
$assetPath : string|null = null
$postcode : string|null = null
$latitude : string|null = null
$longitude : string|null = null
$translations : Collection = new ArrayCollection()

addTranslation()

public addTranslation(TTranslation $translation) : $this
Parameters
$translation : TTranslation
Return values
$this

callInitMethods()

Calls `init{TraitName}()` for every used trait that defines such a method.

public callInitMethods() : void

getActive()

public getActive() : bool
Return values
bool

getAllTraits()

Returns all traits the class uses, including those used by parent classes and nested traits.

public getAllTraits() : array<string, string>
Return values
array<string, string>

getAssetFile()

Returns the `FtpAsset` derived from the path (lazy, works after Doctrine hydration too).

public getAssetFile() : FtpAsset|null
Return values
FtpAsset|null

getAssetPath()

public getAssetPath() : string|null
Return values
string|null

getCountryCode()

public getCountryCode() : string|null
Return values
string|null

getGeonameId()

public getGeonameId() : int|null
Return values
int|null

getIconClass()

public getIconClass() : string|null
Return values
string|null

getImageId()

public getImageId() : int|null
Return values
int|null

getIsCountry()

public getIsCountry() : bool
Return values
bool

getKey()

public getKey() : string|null
Return values
string|null

getLatitude()

public getLatitude() : string|null
Return values
string|null

getLevel()

public getLevel() : int
Return values
int

getLft()

public getLft() : int
Return values
int

getLongitude()

public getLongitude() : string|null
Return values
string|null

getMain()

public getMain() : bool
Return values
bool

getNameAscii()

public getNameAscii() : string|null
Return values
string|null

getOfficialCode()

public getOfficialCode() : string|null
Return values
string|null

getParentId()

public getParentId() : int|null
Return values
int|null

getPopulation()

public getPopulation() : int|null
Return values
int|null

getPostcode()

public getPostcode() : string|null
Return values
string|null

getRgt()

public getRgt() : int
Return values
int

getSuggestWeight()

public getSuggestWeight() : int
Return values
int

getTranslation()

public getTranslation(int $langId) : TTranslation|null
Parameters
$langId : int
Return values
TTranslation|null

getTranslations()

public getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>

getType()

public getType() : string|null
Return values
string|null

isActive()

public isActive() : bool
Return values
bool

isCountry()

public isCountry() : bool
Return values
bool

isMain()

public isMain() : bool
Return values
bool

removeTranslation()

public removeTranslation(TTranslation $translation) : $this
Parameters
$translation : TTranslation
Return values
$this

setActive()

public setActive(bool $active) : $this
Parameters
$active : bool
Return values
$this

setAssetPath()

public setAssetPath(string|null $assetPath) : $this
Parameters
$assetPath : string|null
Return values
$this

setCountryCode()

public setCountryCode(string|null $countryCode) : static
Parameters
$countryCode : string|null
Return values
static

setGeonameId()

public setGeonameId(int|null $geonameId) : static
Parameters
$geonameId : int|null
Return values
static

setIconClass()

public setIconClass(string|null $iconClass) : $this
Parameters
$iconClass : string|null
Return values
$this

setId()

public setId(int|null $id) : $this
Parameters
$id : int|null
Return values
$this

setImageId()

public setImageId(int|null $imageId) : $this
Parameters
$imageId : int|null
Return values
$this

setIsCountry()

public setIsCountry(bool $isCountry) : $this
Parameters
$isCountry : bool
Return values
$this

setKey()

public setKey(string|null $key) : $this
Parameters
$key : string|null
Return values
$this

setLatitude()

public setLatitude(string|null $latitude) : $this
Parameters
$latitude : string|null
Return values
$this

setLevel()

public setLevel(int $level) : $this
Parameters
$level : int
Return values
$this

setLft()

public setLft(int $lft) : $this
Parameters
$lft : int
Return values
$this

setLongitude()

public setLongitude(string|null $longitude) : $this
Parameters
$longitude : string|null
Return values
$this

setMain()

public setMain(bool $main) : $this
Parameters
$main : bool
Return values
$this

setNameAscii()

public setNameAscii(string|null $nameAscii) : static
Parameters
$nameAscii : string|null
Return values
static

setOfficialCode()

public setOfficialCode(string|null $officialCode) : static
Parameters
$officialCode : string|null
Return values
static

setParentId()

public setParentId(int|null $parentId) : $this
Parameters
$parentId : int|null
Return values
$this

setPopulation()

public setPopulation(int|null $population) : static
Parameters
$population : int|null
Return values
static

setPostcode()

public setPostcode(string|null $postcode) : $this
Parameters
$postcode : string|null
Return values
$this

setRgt()

public setRgt(int $rgt) : $this
Parameters
$rgt : int
Return values
$this

setSuggestWeight()

public setSuggestWeight(int $suggestWeight) : static
Parameters
$suggestWeight : int
Return values
static

setTranslations()

public setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
$translations : Collection<int, TTranslation>|array<int, TTranslation>
Return values
$this

setType()

public setType(string|null $type) : static
Parameters
$type : string|null
Return values
static

getTraitsRecursive()

Walks the trait list recursively and collects nested traits too.

private static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
$traits : array<string, string>
Return values
array<string, string>
On this page

Search results