CoolCMS API

ExternalConnection extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait

AbstractYes

External connection (third-party integrations: reCAPTCHA, maps, analytics ...).

A row is created by an "installation" (SQL), not by hand in the admin. type is the type code (recaptcha_v2); the configuration fields of a type are defined by the type registry in Core, this entity only stores them.

config is JSON text in the DB (long text) and always array<string, scalar|null> in PHP. The column is held by the protected config property (a string); the public interface (getConfig/setConfig) speaks arrays, so the hydrator (extract via getter, hydrate via setter) keeps an array along the whole path Api -> wire -> Admin entity and back. The configuration contains secret keys; Api read and write are for administrators only (RBAC).

Attributes
#[MappedSuperclass]
#[TableAlias]
$alias: 'externalConnection'

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

$config  : string|null
$enabled  : bool
$id  : int|null
$insertDatetime  : DateTime
$type  : string
$updateDatetime  : DateTime|null

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.
getConfig()  : array<string, scalar|null>
Invalid, empty or non-object JSON yields `[]`; non-scalar values are dropped.
getId()  : int|null
getInsertDatetime()  : DateTime
getType()  : string
getUpdateDatetime()  : DateTime|null
isEnabled()  : bool
isPersisted()  : bool
setConfig()  : $this
setEnabled()  : $this
setId()  : $this
setInsertDatetime()  : $this
setType()  : $this
setUpdateDatetime()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$config

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

$enabled

protected bool $enabled = false
Attributes
#[Column]
$name: 'enabled'
$type: 'boolean'
$options: ['default' => false]

$id

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

$type

protected string $type = ''
Attributes
#[Column]
$name: 'type'
$type: 'string'
$length: 64
$unique: true

$updateDatetime

protected DateTime|null $updateDatetime = null
Attributes
#[Column]
$name: 'update_datetime'
$type: 'datetime'
$nullable: true
#[ExternalReadonly]

Methods

__construct()

public __construct([int|null $id = null ][, string $type = '' ][, bool $enabled = false ][, string|null $config = null ][, DateTime $insertDatetime = new DateTime() ][, DateTime|null $updateDatetime = null ]) : mixed
Parameters
$id : int|null = null
$type : string = ''
$enabled : bool = false
$config : string|null = null
$insertDatetime : DateTime = new DateTime()
$updateDatetime : DateTime|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>

getConfig()

Invalid, empty or non-object JSON yields `[]`; non-scalar values are dropped.

public getConfig() : array<string, scalar|null>
Return values
array<string, scalar|null>

getInsertDatetime()

public getInsertDatetime() : DateTime
Return values
DateTime

getUpdateDatetime()

public getUpdateDatetime() : DateTime|null
Return values
DateTime|null

setConfig()

public setConfig(array<string, scalar|null> $config) : $this
Parameters
$config : array<string, scalar|null>
Return values
$this

setEnabled()

public setEnabled(bool $enabled) : $this
Parameters
$enabled : bool
Return values
$this

setId()

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

setInsertDatetime()

public setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
$insertDatetime : DateTime
Return values
$this

setType()

public setType(string $type) : $this
Parameters
$type : string
Return values
$this

setUpdateDatetime()

public setUpdateDatetime(DateTime|null $updateDatetime) : $this
Parameters
$updateDatetime : DateTime|null
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