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 BelongsToRelation

Representation of the one-to-one relation.

ICanBoogie\ActiveRecord\Relation uses ICanBoogie\Accessor\AccessorTrait (not available)
Extended by ICanBoogie\ActiveRecord\BelongsToRelation
Namespace: ICanBoogie\ActiveRecord
Located at BelongsToRelation.php

Methods summary

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.

Overrides

ICanBoogie\ActiveRecord\Relation::__construct
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 activerecord prototype.
$property
The name of the property.

Overrides

ICanBoogie\ActiveRecord\Relation::alter_prototype
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

Overrides

ICanBoogie\ActiveRecord\Relation::resolve_property_name

Methods inherited from ICanBoogie\ActiveRecord\Relation

get_as(), get_foreign_key(), get_local_key(), get_parent(), get_related(), resolve_activerecord_class(), resolve_related()

Properties summary

Properties inherited from ICanBoogie\ActiveRecord\Relation

$as, $foreign_key, $local_key, $parent, $related

Magic properties inherited from ICanBoogie\ActiveRecord\Relation

$as, $foreign_key, $local_key, $parent, $related

ICanBoogie/ActiveRecord v2.2.0 API documentation generated by ApiGen