class ActiveRow implements IteratorAggregate, ArrayAccess

Represents database row with support for relations.

ActiveRow is based on the great library NotORM http://www.notorm.com written by Jakub Vrana.

Methods

__construct(array $data, Selection $table)

No description

void
setTable(Selection $table)

No description

getTable()

No description

getExplorer()

No description

string
__toString()

No description

array
toArray()

No description

mixed
getPrimary(bool $throw = true)

Returns primary key value, or an array of values for composite primary keys.

string
getSignature(bool $throw = true)

Returns row signature (composition of primary keys).

ActiveRow|null
ref(string $key, string|null $throughColumn = null)

Returns referenced row, or null if the row does not exist.

related(string $key, string|null $throughColumn = null)

Returns referencing rows collection.

bool
update(iterable $data)

Updates row data and refreshes the instance from database. Returns true if the row was changed.

int
delete()

Deletes the row from database.

getIterator()

No description

void
offsetSet($column, $value)

No description

mixed
offsetGet($column)

No description

bool
offsetExists($column)

No description

void
offsetUnset($column)

No description

void
__set(string $column, mixed $value)

No description

mixed
__get(string $key)

Returns column value, or a referenced row if the key matches a relationship.

bool
__isset(string $key)

No description

void
__unset(string $key)

No description

bool
accessColumn(string|null $key, bool $selectColumn = true)

No description

void
removeAccessColumn(string $key)

No description

Details

at line 24
__construct(array $data, Selection $table)

No description

Parameters

array $data
Selection $table

at line 37
void setTable(Selection $table)

internal  
 

No description

Parameters

Selection $table

Return Value

void

at line 47
Selection getTable()

internal  
 

No description

Return Value

Selection

at line 53
Explorer getExplorer()

No description

Return Value

Explorer

at line 59
string __toString()

No description

Return Value

string

at line 66
array toArray()

No description

Return Value

array

at line 76
mixed getPrimary(bool $throw = true)

Returns primary key value, or an array of values for composite primary keys.

Parameters

bool $throw

Return Value

mixed

at line 112
string getSignature(bool $throw = true)

Returns row signature (composition of primary keys).

Parameters

bool $throw

Return Value

string

at line 121
ActiveRow|null ref(string $key, string|null $throughColumn = null)

Returns referenced row, or null if the row does not exist.

Parameters

string $key
string|null $throughColumn

Return Value

ActiveRow|null

Returns referencing rows collection.

Parameters

string $key
string|null $throughColumn

Return Value

GroupedSelection

at line 151
bool update(iterable $data)

Updates row data and refreshes the instance from database. Returns true if the row was changed.

Parameters

iterable $data

Return Value

bool

at line 186
int delete()

Deletes the row from database.

Return Value

int

number of affected rows

at line 204
Iterator getIterator()

No description

Return Value

Iterator

at line 214
void offsetSet($column, $value)

No description

Parameters

$column
$value

Return Value

void

at line 220
mixed offsetGet($column)

No description

Parameters

$column

Return Value

mixed

at line 226
bool offsetExists($column)

No description

Parameters

$column

Return Value

bool

at line 232
void offsetUnset($column)

No description

Parameters

$column

Return Value

void

at line 238
void __set(string $column, mixed $value)

No description

Parameters

string $column
mixed $value

Return Value

void

at line 249
mixed __get(string $key)

Returns column value, or a referenced row if the key matches a relationship.

Parameters

string $key

Return Value

mixed

Exceptions

MemberAccessException

at line 267
bool __isset(string $key)

No description

Parameters

string $key

Return Value

bool

at line 284
void __unset(string $key)

No description

Parameters

string $key

Return Value

void

at line 291
bool accessColumn(string|null $key, bool $selectColumn = true)

internal  
 

No description

Parameters

string|null $key
bool $selectColumn

Return Value

bool

at line 307
protected void removeAccessColumn(string $key)

No description

Parameters

string $key

Return Value

void