Skip to content

Model

  • Full name: \Qubus\Expressive\ActiveRecord\Model

Constants

Constant Visibility Type Value
DATE_FORMAT public 'Y-m-d H:i:s.u'

Properties

connection

Database connection.

protected static ?\Qubus\Expressive\Connection $connection
  • This property is static.

queryBuilder

Default orm query builder.

protected ?\Qubus\Expressive\QueryBuilder $queryBuilder

tableName

Database table name.

protected ?string $tableName

tablePrefix

Database table prefix.

protected ?string $tablePrefix

foreignKey

Parent key found in related model.

protected string $foreignKey

primaryKey

Primary key of parent model.

protected string $primaryKey

incrementing

protected bool $incrementing

exists

public bool $exists

data

Query result data.

protected array $data

relations

To stored loaded relation.

protected array $relations

fillable

Whitelist of attributes that are checked for mass assignment.

protected array $fillable

guarded

Blacklist of attributes that cannot be mass-assigned.

protected array $guarded

guardFlag

Flag of whether fillable/guarded attributes should be guarded.

protected bool $guardFlag

isReadOnly

Sets whether model is read only.

protected bool $isReadOnly

Methods

__construct

public __construct(array $newData = []): mixed

Parameters:

Parameter Type Description
$newData array

connection

public static connection(\Qubus\Expressive\Connection $connection): \Qubus\Expressive\Connection
  • This method is static.

Parameters:

Parameter Type Description
$connection \Qubus\Expressive\Connection

dbalQuery

protected dbalQuery(): \Qubus\Expressive\QueryBuilder

query

protected query(): static

all

protected all(string|array $columns = '*'): \Qubus\Expressive\ActiveRecord\Result

Parameters:

Parameter Type Description
$columns string|array

get

protected get(string|array $columns = '*'): \Qubus\Expressive\ActiveRecord\Result

Parameters:

Parameter Type Description
$columns string|array

first

protected first(string|array $columns = '*'): ?\Qubus\Expressive\ActiveRecord\Row

Parameters:

Parameter Type Description
$columns string|array

find

protected find(mixed $id): \Qubus\Expressive\ActiveRecord\Result|\Qubus\Expressive\ActiveRecord\Row|null

Parameters:

Parameter Type Description
$id mixed

pluck

protected pluck(mixed $field): mixed

Parameters:

Parameter Type Description
$field mixed

create

protected static create(array $data): bool|static|\Qubus\Expressive\Database|\Qubus\Expressive\QueryBuilder|int
  • This method is static.

Parameters:

Parameter Type Description
$data array

Throws:


update

protected update(array $data): bool|\Qubus\Expressive\Database|\Qubus\Expressive\QueryBuilder|int

Parameters:

Parameter Type Description
$data array

Throws:


save

protected save(): bool|int|\Qubus\Expressive\Database|\Qubus\Expressive\QueryBuilder

Throws:


delete

protected delete(): bool|\Qubus\Expressive\Database|\Qubus\Expressive\QueryBuilder|int

Throws:


getPrimaryKey

public getPrimaryKey(): string

getData

public getData(?string $field = null): mixed

Parameters:

Parameter Type Description
$field ?string

setData

public setData(mixed $field, mixed $value = null): void

Parameters:

Parameter Type Description
$field mixed
$value mixed

toArray

public toArray(): array

toJson

public toJson(): bool|string

hasOne

====================================== Relationship Methods ======================================

public hasOne(\Qubus\Expressive\ActiveRecord\Model|string $related, string|int|null $foreignKey = null): \Qubus\Expressive\ActiveRecord\Relations\HasOne

Parameters:

Parameter Type Description
$related \Qubus\Expressive\ActiveRecord\Model|string
$foreignKey string|int|null

hasMany

public hasMany(\Qubus\Expressive\ActiveRecord\Model|string $related, string|int|null $foreignKey = null): \Qubus\Expressive\ActiveRecord\Relations\HasMany

Parameters:

Parameter Type Description
$related \Qubus\Expressive\ActiveRecord\Model|string
$foreignKey string|int|null

belongsTo

public belongsTo(\Qubus\Expressive\ActiveRecord\Model|string $related, string|int|null $foreignKey = null): \Qubus\Expressive\ActiveRecord\Relations\BelongsTo

Parameters:

Parameter Type Description
$related \Qubus\Expressive\ActiveRecord\Model|string
$foreignKey string|int|null

belongsToMany

public belongsToMany(\Qubus\Expressive\ActiveRecord\Model|string $related, ?string $pivotTable = null, string|int|null $foreignKey = null, string|int|null $otherKey = null): \Qubus\Expressive\ActiveRecord\Relations\BelongsToMany

Parameters:

Parameter Type Description
$related \Qubus\Expressive\ActiveRecord\Model|string
$pivotTable ?string
$foreignKey string|int|null
$otherKey string|int|null

setRelation

public setRelation(mixed $name, \Qubus\Expressive\ActiveRecord\Relations\Relation $relation): void

Parameters:

Parameter Type Description
$name mixed
$relation \Qubus\Expressive\ActiveRecord\Relations\Relation

getRelation

public getRelation(mixed $name): mixed

Parameters:

Parameter Type Description
$name mixed

load

public load(string $related): void

Parameters:

Parameter Type Description
$related string

aggregates

protected aggregates(mixed $function, mixed $field): mixed

Parameters:

Parameter Type Description
$function mixed
$field mixed

max

protected max(mixed $field): float|int

Parameters:

Parameter Type Description
$field mixed

min

protected min(mixed $field): float|int

Parameters:

Parameter Type Description
$field mixed

avg

protected avg(mixed $field): float|int

Parameters:

Parameter Type Description
$field mixed

sum

protected sum(mixed $field): float|int

Parameters:

Parameter Type Description
$field mixed

count

protected count(mixed $field = null): float|int

Parameters:

Parameter Type Description
$field mixed

setAttributesViaMassAssignment

====================================== Mass assignment protection.

protected setAttributesViaMassAssignment(array|object $attributes): void

======================================

Parameters:

Parameter Type Description
$attributes array|object

timestamp

protected timestamp(): void

Throws:


isReadOnly

private isReadOnly(string $methodName): void

Parameters:

Parameter Type Description
$methodName string

Throws:


__call

====================================== Magic Methods ======================================

public __call(mixed $name, mixed $arguments): mixed

Parameters:

Parameter Type Description
$name mixed
$arguments mixed

__callStatic

public static __callStatic(mixed $name, mixed $arguments): mixed
  • This method is static.

Parameters:

Parameter Type Description
$name mixed
$arguments mixed

__get

public __get(mixed $field): mixed

Parameters:

Parameter Type Description
$field mixed

__set

public __set(mixed $field, mixed $value): void

Parameters:

Parameter Type Description
$field mixed
$value mixed

__isset

public __isset(mixed $field): bool

Parameters:

Parameter Type Description
$field mixed


Automatically generated on 2025-10-13