ApiClient
extends BaseEntity
in package
implements
IdentifiableInterface
uses
IdentifiableTrait
Client of the external Api: an application allowed to call the Api with its key (`X-API-Key`).
The key only says "this application may call the Api"; the data returned is decided by
the roles of the user from the JWT (or guest). A client can only restrict them: allowed
roles live in the join table cms_system_api_client_roles (read and written by
ApiClientManager, the entity does not map
them). It carries own request limits (null = default from api.clientKey.limits).
Application keys live in a separate table cms_system_api_client_keys
(ApiClientKey); an application may have several, each with an optional expiry.
There is no key fingerprint here; lastUsedAt is a summary over all its keys.
Attributes
- #[MappedSuperclass]
- #[TableAlias]
- $alias: 'apiClient'
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
- $createdAt : DateTime|null
- $enabled : bool
- $id : int|null
- $ipLimitPerMinute : int|null
- $lastUsedAt : DateTime|null
- $limitPerMinute : int|null
- $limitPerSecond : int|null
- $name : string
- $notes : string|null
- $revokedAt : DateTime|null
- $updatedAt : DateTime|null
- $userLimitPerMinute : int|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.
- getCreatedAt() : DateTime|null
- getEnabled() : bool
- getId() : int|null
- getIpLimitPerMinute() : int|null
- getLastUsedAt() : DateTime|null
- getLimitPerMinute() : int|null
- getLimitPerSecond() : int|null
- getName() : string
- getNotes() : string|null
- getRevokedAt() : DateTime|null
- getUpdatedAt() : DateTime|null
- getUserLimitPerMinute() : int|null
- isEnabled() : bool
- isPersisted() : bool
- isRevoked() : bool
- isUsable() : bool
- setCreatedAt() : $this
- setEnabled() : $this
- setId() : $this
- setIpLimitPerMinute() : $this
- setLastUsedAt() : $this
- setLimitPerMinute() : $this
- setLimitPerSecond() : $this
- setName() : $this
- setNotes() : $this
- setRevokedAt() : $this
- setUpdatedAt() : $this
- setUserLimitPerMinute() : $this
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$createdAt
protected
DateTime|null
$createdAt
= null
Attributes
- #[Column]
- $name: 'created_at'
- $type: 'datetime'
$enabled
protected
bool
$enabled
= true
Attributes
- #[Column]
- $name: 'enabled'
- $type: 'boolean'
- $options: ['default' => true]
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $type: 'integer'
- $name: 'api_client_id'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$ipLimitPerMinute
protected
int|null
$ipLimitPerMinute
= null
Attributes
- #[Column]
- $name: 'ip_limit_per_minute'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$lastUsedAt
protected
DateTime|null
$lastUsedAt
= null
Attributes
- #[Column]
- $name: 'last_used_at'
- $type: 'datetime'
- $nullable: true
$limitPerMinute
protected
int|null
$limitPerMinute
= null
Attributes
- #[Column]
- $name: 'limit_per_minute'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$limitPerSecond
protected
int|null
$limitPerSecond
= null
Attributes
- #[Column]
- $name: 'limit_per_second'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$name
protected
string
$name
= ''
Attributes
- #[Column]
- $name: 'name'
- $type: 'string'
- $length: 100
$notes
protected
string|null
$notes
= null
Attributes
- #[Column]
- $name: 'notes'
- $type: 'string'
- $length: 255
- $nullable: true
$revokedAt
protected
DateTime|null
$revokedAt
= null
Attributes
- #[Column]
- $name: 'revoked_at'
- $type: 'datetime'
- $nullable: true
$updatedAt
protected
DateTime|null
$updatedAt
= null
Attributes
- #[Column]
- $name: 'updated_at'
- $type: 'datetime'
- $nullable: true
$userLimitPerMinute
protected
int|null
$userLimitPerMinute
= null
Attributes
- #[Column]
- $name: 'user_limit_per_minute'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
Methods
__construct()
public
__construct([int|null $id = null ][, string $name = '' ][, bool $enabled = true ][, DateTime|null $createdAt = null ][, DateTime|null $revokedAt = null ][, DateTime|null $lastUsedAt = null ][, DateTime|null $updatedAt = null ][, string|null $notes = null ][, int|null $limitPerSecond = null ][, int|null $limitPerMinute = null ][, int|null $userLimitPerMinute = null ][, int|null $ipLimitPerMinute = null ]) : mixed
Parameters
- $id : int|null = null
- $name : string = ''
- $enabled : bool = true
- $createdAt : DateTime|null = null
- $revokedAt : DateTime|null = null
- $lastUsedAt : DateTime|null = null
- $updatedAt : DateTime|null = null
- $notes : string|null = null
- $limitPerSecond : int|null = null
- $limitPerMinute : int|null = null
- $userLimitPerMinute : int|null = null
- $ipLimitPerMinute : int|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() : DateTime|null
Return values
DateTime|nullgetEnabled()
public
getEnabled() : bool
Return values
boolgetId()
public
getId() : int|null
Return values
int|nullgetIpLimitPerMinute()
public
getIpLimitPerMinute() : int|null
Return values
int|nullgetLastUsedAt()
public
getLastUsedAt() : DateTime|null
Return values
DateTime|nullgetLimitPerMinute()
public
getLimitPerMinute() : int|null
Return values
int|nullgetLimitPerSecond()
public
getLimitPerSecond() : int|null
Return values
int|nullgetName()
public
getName() : string
Return values
stringgetNotes()
public
getNotes() : string|null
Return values
string|nullgetRevokedAt()
public
getRevokedAt() : DateTime|null
Return values
DateTime|nullgetUpdatedAt()
public
getUpdatedAt() : DateTime|null
Return values
DateTime|nullgetUserLimitPerMinute()
public
getUserLimitPerMinute() : int|null
Return values
int|nullisEnabled()
public
isEnabled() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolisRevoked()
public
isRevoked() : bool
Return values
boolisUsable()
public
isUsable() : bool
Return values
boolsetCreatedAt()
public
setCreatedAt(DateTime|null $createdAt) : $this
Parameters
- $createdAt : DateTime|null
Return values
$thissetEnabled()
public
setEnabled(bool $enabled) : $this
Parameters
- $enabled : bool
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetIpLimitPerMinute()
public
setIpLimitPerMinute(int|null $ipLimitPerMinute) : $this
Parameters
- $ipLimitPerMinute : int|null
Return values
$thissetLastUsedAt()
public
setLastUsedAt(DateTime|null $lastUsedAt) : $this
Parameters
- $lastUsedAt : DateTime|null
Return values
$thissetLimitPerMinute()
public
setLimitPerMinute(int|null $limitPerMinute) : $this
Parameters
- $limitPerMinute : int|null
Return values
$thissetLimitPerSecond()
public
setLimitPerSecond(int|null $limitPerSecond) : $this
Parameters
- $limitPerSecond : int|null
Return values
$thissetName()
public
setName(string $name) : $this
Parameters
- $name : string
Return values
$thissetNotes()
public
setNotes(string|null $notes) : $this
Parameters
- $notes : string|null
Return values
$thissetRevokedAt()
public
setRevokedAt(DateTime|null $revokedAt) : $this
Parameters
- $revokedAt : DateTime|null
Return values
$thissetUpdatedAt()
public
setUpdatedAt(DateTime|null $updatedAt) : $this
Parameters
- $updatedAt : DateTime|null
Return values
$thissetUserLimitPerMinute()
public
setUserLimitPerMinute(int|null $userLimitPerMinute) : $this
Parameters
- $userLimitPerMinute : int|null
Return values
$thisgetTraitsRecursive()
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>