Overview

Namespaces

  • Alchemy
    • core
      • query
      • schema
    • dialect
    • engine
    • orm
    • tests
    • util
      • promise
  • PHP

Classes

  • DataMapper
  • DDL
  • ManyToOne
  • OneToMany
  • OneToOne
  • ORMQuery
  • ORMTable
  • ORMTableRef
  • RelatedSet
  • Relationship
  • Session
  • SessionSelect
  • WorkQueue
  • Overview
  • Namespace
  • Class
  • Tree

Class Relationship

Base class for defining the relationships between models Subclass this to create separate relationship types like OneToOne, OneToMany, etc.

Alchemy\core\Element implements Alchemy\core\IElement
Extended by Alchemy\orm\Relationship

Direct known subclasses

Alchemy\orm\ManyToOne, Alchemy\orm\OneToMany, Alchemy\orm\OneToOne
Namespace: Alchemy\orm
Located at alchemy/orm/schema/Relationship.php
Methods summary
public
# __construct( string $type, string $args, array $origin, boolean $name, mixed $createBackref = true )

Object constructor for an abstract model relationship

Object constructor for an abstract model relationship

Parameters

$type
string
$name Relationship Name
$args
string
$origin Originating Class
$origin
array
$args array([0] => "DestinationClass", [backref] => "BackrefName")
$name
boolean
$createBackref Internal Use Only
$createBackref

Overrides

Alchemy\core\Element::__construct()
public
# assertDestinationType( mixed $dest )
protected
# createBackref( )

Create an inverse relationship to match this one.

Create an inverse relationship to match this one.

protected Alchemy\core\schema\ForeignKey
# findForeignKey( )

Find the foreign key that defines how to traverse this relationship

Find the foreign key that defines how to traverse this relationship

Returns

Alchemy\core\schema\ForeignKey
protected Alchemy\core\schema\ForeignKey
# findForeignKeyImpl( Alchemy\core\schema\Table $tableA, Alchemy\core\schema\Table $tableB )

Implementation function used by Alchemy\orm\Relationship::findForeignKey()

Implementation function used by Alchemy\orm\Relationship::findForeignKey()

Parameters

$tableA
Alchemy\core\schema\Table
$tableA
$tableB
Alchemy\core\schema\Table
$tableB

Returns

Alchemy\core\schema\ForeignKey
public string
# getBackref( )

Get the name of the backref of this relationship

Get the name of the backref of this relationship

Returns

string
public string
# getInverse( )

Get the inverse side of this relationship

Get the inverse side of this relationship

Returns

string
public string
# getDestinationClass( )

Get the destination class name

Get the destination class name

Returns

string
public string
# getName( )

Get the name of this relationship

Get the name of this relationship

Returns

string
public
# getRef( mixed $origin )
public Alchemy\core\schema\ForeignKey
# getForeignKey( )

Get the ForeignKey associated with this relationship

Get the ForeignKey associated with this relationship

Returns

Alchemy\core\schema\ForeignKey
public string
# getOriginClass( )

Get the class name of the originating class

Get the class name of the originating class

Returns

string
public boolean
# isSingleObject( )

Return true if this relationship can structurally only ever return a single object.

Return true if this relationship can structurally only ever return a single object.

Returns

boolean
public boolean
# isParent( )

Return true if the origin of this relationship is the source of foreign key index. False if the source of the foreign key is the destination of this relationship

Return true if the origin of this relationship is the source of foreign key index. False if the source of the foreign key is the destination of this relationship

Returns

boolean
public boolean
# isNullable( )

Return true if this relationship can potentially be NULL (empty).

Return true if this relationship can potentially be NULL (empty).

Returns

boolean
public array
# getRemoteColumnMap( mixed $origin )

Return a map of remote column names and their values according to this relationship, relative to $origin, for querying. Applies whether $origin is a table reference or a DataMapper. Must be implemented by all Relationship types.

Return a map of remote column names and their values according to this relationship, relative to $origin, for querying. Applies whether $origin is a table reference or a DataMapper. Must be implemented by all Relationship types.

Parameters

$origin
mixed
$origin

Returns

array
[Column => Value, ...]
Methods inherited from Alchemy\core\Element
__callStatic(), __clone(), addTag(), addTags(), copy(), define(), define_alias(), getDescription(), getID(), getTag(), getType(), get_definition(), listTags(), normalize_arg()
Properties summary
protected mixed $name
#
protected mixed $origin
#
protected mixed $destination
#
protected mixed $foreignKey
#
protected mixed $args
#
protected mixed $inverse
#
Properties inherited from Alchemy\core\Element
$id, $tags, $type
API documentation generated by ApiGen 2.8.0