CoolCMS API

GeocodingCache extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait

AbstractYes

Cache of external geocoding.

The mapping serves the repository layer (getEntityClass()) and as the source of column limits; reads and writes go through raw SQL in GeocodingCacheRepository (atomic upsert by query_hash, hits + 1).

Attributes
#[MappedSuperclass]
#[TableAlias]
'geocodingCache'

Table of Contents

Interfaces

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

$country  : string
$createdAt  : DateTimeImmutable|null
$formattedAddress  : string|null
$hits  : int
$id  : int|null
$lastUsedAt  : DateTimeImmutable|null
$latitude  : string|null
$longitude  : string|null
$query  : string
$queryHash  : string
$status  : string

Methods

__construct()  : mixed
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getCountry()  : string
getCreatedAt()  : DateTimeImmutable|null
getFormattedAddress()  : string|null
getHits()  : int
getId()  : int|null
getLastUsedAt()  : DateTimeImmutable|null
getLatitude()  : string|null
getLongitude()  : string|null
getQuery()  : string
getQueryHash()  : string
getStatus()  : string
isPersisted()  : bool
setCountry()  : $this
setCreatedAt()  : $this
setFormattedAddress()  : $this
setHits()  : $this
setId()  : $this
setLastUsedAt()  : $this
setLatitude()  : $this
setLongitude()  : $this
setQuery()  : $this
setQueryHash()  : $this
setStatus()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$country

protected string $country = ''
Attributes
#[Column]
$name: 'country'
$type: 'string'
$length: 2
$options: ['fixed' => true]

$createdAt

protected DateTimeImmutable|null $createdAt = null
Attributes
#[Column]
$name: 'created_at'
$type: 'datetime_immutable'

$formattedAddress

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

$hits

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

$id

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

$lastUsedAt

protected DateTimeImmutable|null $lastUsedAt = null
Attributes
#[Column]
$name: 'last_used_at'
$type: 'datetime_immutable'

$latitude

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

$longitude

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

$query

protected string $query = ''
Attributes
#[Column]
$name: 'query'
$type: 'string'
$length: 500

$queryHash

protected string $queryHash = ''
Attributes
#[Column]
$name: 'query_hash'
$type: 'string'
$length: 40
$unique: true
$options: ['fixed' => true]

$status

protected string $status = ''
Attributes
#[Column]
$name: 'status'
$type: 'string'
$length: 20

Methods

__construct()

public __construct([int|null $id = null ][, string $country = '' ][, string $queryHash = '' ][, string $query = '' ][, string|null $formattedAddress = null ][, string|null $latitude = null ][, string|null $longitude = null ][, string $status = '' ][, int $hits = 0 ][, DateTimeImmutable|null $createdAt = null ][, DateTimeImmutable|null $lastUsedAt = null ]) : mixed
Parameters
$id : int|null = null
$country : string = ''
$queryHash : string = ''
$query : string = ''
$formattedAddress : string|null = null
$latitude : string|null = null
$longitude : string|null = null
$status : string = ''
$hits : int = 0
$createdAt : DateTimeImmutable|null = null
$lastUsedAt : DateTimeImmutable|null = null

callInitMethods()

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

public callInitMethods() : void

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>

getCreatedAt()

public getCreatedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

getFormattedAddress()

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

getLastUsedAt()

public getLastUsedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

getLatitude()

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

getLongitude()

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

getQueryHash()

public getQueryHash() : string
Return values
string

setCountry()

public setCountry(string $country) : $this
Parameters
$country : string
Return values
$this

setCreatedAt()

public setCreatedAt(DateTimeImmutable|null $createdAt) : $this
Parameters
$createdAt : DateTimeImmutable|null
Return values
$this

setFormattedAddress()

public setFormattedAddress(string|null $formattedAddress) : $this
Parameters
$formattedAddress : string|null
Return values
$this

setHits()

public setHits(int $hits) : $this
Parameters
$hits : int
Return values
$this

setId()

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

setLastUsedAt()

public setLastUsedAt(DateTimeImmutable|null $lastUsedAt) : $this
Parameters
$lastUsedAt : DateTimeImmutable|null
Return values
$this

setLatitude()

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

setLongitude()

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

setQuery()

public setQuery(string $query) : $this
Parameters
$query : string
Return values
$this

setQueryHash()

public setQueryHash(string $queryHash) : $this
Parameters
$queryHash : string
Return values
$this

setStatus()

public setStatus(string $status) : $this
Parameters
$status : string
Return values
$this

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