Class Model
Base class for activerecord models.
- ICanBoogie\Prototyped
- ┗ ICanBoogie\ActiveRecord\Table
- ┗ ICanBoogie\ActiveRecord\Model implements ArrayAccess
Methods summary
protected
get_relations( void )
: ICanBoogie\ActiveRecord\RelationCollection
Return the relations of this model to other models.
protected
lazy_get_activerecord_cache( void )
: ICanBoogie\ActiveRecord\ActiveRecordCache
Returns the records cache.
public
__construct( ICanBoogie\ActiveRecord\ModelCollection
$models
, array $attributes
)
Override the constructor to provide support for the ICanBoogie\ActiveRecord\Model::ACTIVERECORD_CLASS
tag and
extended support for the ICanBoogie\ActiveRecord\Table::EXTENDING
tag.
protected
get_activerecord_class( void )
: string
Returns the class of the active records of the model.
public
find( mixed $key
)
: ICanBoogie\ActiveRecord
|ICanBoogie\ActiveRecord[]
Finds a record or a collection of records.
public
save( array $properties
, mixed|null $key
= null, array $options
= [] )
: mixed
Because records are cached, we need to remove the record from the cache when it is saved, so that loading the record again returns the updated record, not the one in the cache.
public
scope( string $scope_name
, array $scope_args
= [] )
: ICanBoogie\ActiveRecord\Query
Invokes a given scope.
public
offsetGet( integer $key
)
: ICanBoogie\ActiveRecord
Alias to ICanBoogie\ActiveRecord\Model::find()
.
protected
new_record( array $properties
= [] )
: ICanBoogie\ActiveRecord
Creates a new ActiveRecord instance.
Methods inherited from ICanBoogie\ActiveRecord\Table
__invoke()
,
assert_has_connection()
,
assert_has_name()
,
assert_has_schema()
,
assert_implements_is_valid()
,
assert_parent_is_valid()
,
construct_with_parent()
,
drop()
,
ensure_has_alias()
,
execute()
,
filter_values()
,
get_alias()
,
get_connection()
,
get_name()
,
get_parent()
,
get_primary()
,
get_schema()
,
get_schema_options()
,
get_unprefixed_name()
,
insert()
,
install()
,
is_installed()
,
lazy_get_extended_schema()
,
lazy_get_select_join()
,
lazy_get_update_join()
,
map_construct_attributes()
,
prepare()
,
query()
,
quote()
,
resolve_statement()
,
save_callback()
,
truncate()
,
uninstall()
,
update()
Magic methods summary
public
select( void )
: ICanBoogie\ActiveRecord\Query
select($expression) The method is forwarded to Query::select.
public
join( void )
: ICanBoogie\ActiveRecord\Query
join($expression) The method is forwarded to Query::join.
public
where( void )
: ICanBoogie\ActiveRecord\Query
where($conditions, $conditions_args = null, $_ = null) The method is forwarded to Query::where.
public
group( void )
: ICanBoogie\ActiveRecord\Query
group($group) The method is forwarded to Query::group.
public
order( void )
: ICanBoogie\ActiveRecord\Query
order($order) The method is forwarded to Query::order.
public
limit( void )
: ICanBoogie\ActiveRecord\Query
limit($limit, $offset = null) The method is forwarded to Query::limit.
public
offset( void )
: ICanBoogie\ActiveRecord\Query
offset($offset) The method is forwarded to Query::offset.
public
belongs_to( void )
: ICanBoogie\ActiveRecord\Model
belongs_to(...$args) Adds a belongs_to relation.
public
has_many( void )
: ICanBoogie\ActiveRecord\Model
has_many($related, $options = []) Adds a has_many relation.
Constants summary
Constants inherited from ICanBoogie\ActiveRecord\Table
ALIAS
,
CONNECTION
,
EXTENDING
,
IMPLEMENTING
,
NAME
,
SCHEMA
Properties summary
protected
$relations
: ICanBoogie\ActiveRecord\RelationCollection
The relations of this model to other models.
Properties inherited from ICanBoogie\ActiveRecord\Table
$alias
,
$connection
,
$implements
,
$name
,
$parent
,
$primary
,
$schema
,
$schema_options
,
$select_join
,
$unprefixed_name
,
$update_join
Magic properties
public
$activerecord_cache
: ICanBoogie\ActiveRecord\ActiveRecordCache
The cache use to store activerecords.
public read-only
$relations
: ICanBoogie\ActiveRecord\Relation[]
The relations of this model to other models.
Magic properties inherited from ICanBoogie\ActiveRecord\Table
$alias
,
$connection
,
$extended_schema
,
$name
,
$primary
,
$schema
,
$schema_options
,
$unprefixed_name