ICanBoogie/ActiveRecord v2.2.0
  • Namespace
  • Class

Namespaces

  • ICanBoogie
    • ActiveRecord

Classes

  • ActiveRecordCacheBase
  • BelongsToRelation
  • Connection
  • ConnectionCollection
  • ConnectionOptions
  • DateTimePropertySupport
  • HasManyRelation
  • Helpers
  • Model
  • ModelCollection
  • Query
  • Relation
  • RelationCollection
  • RelationNotDefined
  • RunTimeActiveRecordCache
  • Statement
  • Table

Interfaces

  • ActiveRecordCache
  • Exception

Traits

  • CreatedAtProperty
  • DateTimeProperty
  • UpdatedAtProperty

Exceptions

  • ActiveRecordClassNotValid
  • ConnectionAlreadyEstablished
  • ConnectionNotDefined
  • ConnectionNotEstablished
  • ModelAlreadyInstantiated
  • ModelNotDefined
  • RecordNotFound
  • ScopeNotDefined
  • StatementNotValid
  • UnableToSetFetchMode

Functions

  • extract_charset_and_collate
  • get_model

Class RelationCollection

Relation collection of a model.

ICanBoogie\ActiveRecord\RelationCollection implements ArrayAccess uses ICanBoogie\Accessor\AccessorTrait (not available)
Namespace: ICanBoogie\ActiveRecord
Located at RelationCollection.php

Methods summary

protected
# get_model( )
public
# __construct( ICanBoogie\ActiveRecord\Model $model )

Initialize the ICanBoogie\ActiveRecord\RelationCollection::$model property.

Initialize the ICanBoogie\ActiveRecord\RelationCollection::$model property.

Parameters

$model
The parent model.
public
# offsetExists( $relation_name )

Implementation of

ArrayAccess::offsetExists()
public
# offsetGet( $relation_name )

Implementation of

ArrayAccess::offsetGet()
public
# offsetSet( $relation_name, $relation )

Implementation of

ArrayAccess::offsetSet()
public
# offsetUnset( $relation_name )

Implementation of

ArrayAccess::offsetUnset()
public ICanBoogie\ActiveRecord\Model
# belongs_to( string|array $belongs_to )

Add a belongs to relation.

Add a belongs to relation.

$cars->belongs_to([ $drivers, $brands ]);
# or
$cars->belongs_to([ 'drivers', 'brands' ]);
# or
$cars->belongs_to($drivers, $brands);
# or
$cars->belongs_to($drivers)->belongs_to($brands);
# or
$cars->belongs_to([

    [ $drivers, [ 'local_key' => 'card_id', 'foreign_key' => 'driver_id' ] ]
    [ $brands, [ 'local_key' => 'brand_id', 'foreign_key' => 'brand_id' ] ]

]);

Parameters

$belongs_to

Returns

ICanBoogie\ActiveRecord\Model
public ICanBoogie\ActiveRecord\Model
# has_many( ICanBoogie\ActiveRecord\Model|string $related, array $options = [] )

Add a one-to-many relation.

Add a one-to-many relation.

$this->has_many('comments');
$this->has_many([ 'comments', 'attachments' ]);
$this->has_many([ [ 'comments', [ 'as' => 'comments' ] ], 'attachments' ]);

Parameters

$related

The related model can be specified using its instance or its identifier.

$options

the following options are available:

  • local_key: The name of the local key. Default: The parent model's primary key.
  • foreign_key: The name of the foreign key. Default: The parent model's primary key.
  • as: The name of the magic property to add to the prototype. Default: a plural name resolved from the foreign model's id.

Returns

ICanBoogie\ActiveRecord\Model

See

ICanBoogie\ActiveRecord\HasManyRelation

Properties summary

protected ICanBoogie\ActiveRecord\Model $model

Parent model.

Parent model.

#
protected ICanBoogie\ActiveRecord\Relation[] $relations

Relations.

Relations.

#

Magic properties

public read-only ICanBoogie\ActiveRecord\Model $model

The parent model.

ICanBoogie/ActiveRecord v2.2.0 API documentation generated by ApiGen