ICanBoogie/ActiveRecord master
  • Namespace
  • Class

Namespaces

  • ICanBoogie
    • ActiveRecord
      • Driver

Classes

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

Interfaces

  • ActiveRecordCache
  • Driver
  • Exception

Traits

  • CreatedAtProperty
  • DateProperty
  • DateTimeProperty
  • FinishAtProperty
  • FinishedAtProperty
  • StartAtProperty
  • StartedAtProperty
  • UpdatedAtProperty

Exceptions

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

Functions

  • extract_charset_and_collate
  • get_model

Class Relation

Representation of a relation.

ICanBoogie\ActiveRecord\Relation uses ICanBoogie\Accessor\AccessorTrait (not available)

Direct known subclasses

ICanBoogie\ActiveRecord\BelongsToRelation, ICanBoogie\ActiveRecord\HasManyRelation

Abstract
Namespace: ICanBoogie\ActiveRecord
Located at ActiveRecord/Relation.php

Methods summary

protected
# get_parent( )
protected
# get_related( )
protected
# get_as( )
protected
# get_local_key( )
protected
# get_foreign_key( )
public
# __construct( ICanBoogie\ActiveRecord\Model $parent, ICanBoogie\ActiveRecord\Model|string $related, array $options = [] )

Initialize the ICanBoogie\ActiveRecord\Relation::$parent, ICanBoogie\ActiveRecord\Relation::$related, ICanBoogie\ActiveRecord\Relation::$as, ICanBoogie\ActiveRecord\Relation::$local_key, and ICanBoogie\ActiveRecord\Relation::$foreign_key properties.

Initialize the ICanBoogie\ActiveRecord\Relation::$parent, ICanBoogie\ActiveRecord\Relation::$related, ICanBoogie\ActiveRecord\Relation::$as, ICanBoogie\ActiveRecord\Relation::$local_key, and ICanBoogie\ActiveRecord\Relation::$foreign_key properties.

Parameters

$parent
The parent model of the relation.
$related

The related model of the relation. Can be specified using its instance or its identifier.

$options

the following options are available:

  • as: The name of the magic property to add to the prototype. Default: a plural name resolved from the foreign model's id.
  • 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.
abstract public ICanBoogie\ActiveRecord\Query
# __invoke( ICanBoogie\ActiveRecord $record )

Create a query with the relation.

Create a query with the relation.

Parameters

$record

Returns

ICanBoogie\ActiveRecord\Query
protected
# alter_prototype( ICanBoogie\Prototype $prototype, string $property )

Add a getter for the relation to the prototype.

Add a getter for the relation to the prototype.

Parameters

$prototype
The active record prototype.
$property
The name of the property.
protected string
# resolve_activerecord_class( ICanBoogie\ActiveRecord\Model $model )

Resolve the active record class name from the specified model.

Resolve the active record class name from the specified model.

Parameters

$model

Returns

string

Throws

LogicException
if the class is ICanBoogie\ActiveRecord.
protected string
# resolve_property_name( ICanBoogie\ActiveRecord\Model|string $related )

Resolve the property name from the related model.

Resolve the property name from the related model.

Parameters

$related
The related model of the relation.

Returns

string
protected ICanBoogie\ActiveRecord\Model
# resolve_related( )

Resolve the related model.

Resolve the related model.

Returns

ICanBoogie\ActiveRecord\Model

Properties summary

protected ICanBoogie\ActiveRecord\Model $parent

The parent model of the relation.

The parent model of the relation.

#
protected ICanBoogie\ActiveRecord\Model $related

The related model of the relation.

The related model of the relation.

#
protected string $as

The name of the relation.

The name of the relation.

#
protected string $local_key

Local key. Default: The parent model's primary key.

Local key. Default: The parent model's primary key.

#
protected string $foreign_key

Foreign key. Default: The parent model's primary key.

Foreign key. Default: The parent model's primary key.

#

Magic properties

public read-only ICanBoogie\ActiveRecord\Model $parent

The parent model of the relation.

public read-only ICanBoogie\ActiveRecord\Model $related

The related model of the relation.

public read-only string $as

The name of the relation.

public read-only string $local_key

The local key.

public read-only string $foreign_key

The foreign key.

ICanBoogie/ActiveRecord master API documentation generated by ApiGen