PHP Class Pheasant\Relationship

Mostra file Open project: lox/pheasant Class Usage Examples

Public Properties

Property Type Description
$class
$foreign
$local

Public Methods

Method Description
__construct ( $class, $local, $foreign = null )
add ( $object, $value )
addJoin ( $query, $parentAlias, $schema, $relName, $nested = [], $joinType = 'inner' ) : void Adds a join clause to the given query for the given schema and relationship. Optionally takes a nested list of relationships that will be recursively joined as needed.
get ( $object, $key )
getter ( $key, $cache = null ) delegate double dispatch calls to type
normalizeMap ( $array ) : array Takes either a flat array of relationships or a nested key=>value array and returns it as a nested format
parseRelName ( $relName ) : array Parses RelName r1 as array('RelName', 'r1') or Relname as array('RelName','RelName')
set ( $object, $key, $value )
setter ( $key )

Protected Methods

Method Description
adder ( $object ) : Closure Helper function that creates a closure that calls the add function
hydrate ( $row ) : DomainObject Delegates to the schema for hydrating
query ( $sql, $params ) : Query Delegates to the finder for querying

Method Details

__construct() public method

public __construct ( $class, $local, $foreign = null )

add() public method

public add ( $object, $value )

addJoin() public static method

Adds a join clause to the given query for the given schema and relationship. Optionally takes a nested list of relationships that will be recursively joined as needed.
public static addJoin ( $query, $parentAlias, $schema, $relName, $nested = [], $joinType = 'inner' ) : void
return void

adder() protected method

Helper function that creates a closure that calls the add function
protected adder ( $object ) : Closure
return Closure

get() public method

public get ( $object, $key )

getter() public method

delegate double dispatch calls to type
public getter ( $key, $cache = null )

hydrate() protected method

Delegates to the schema for hydrating
protected hydrate ( $row ) : DomainObject
return DomainObject

normalizeMap() public static method

Takes either a flat array of relationships or a nested key=>value array and returns it as a nested format
public static normalizeMap ( $array ) : array
return array

parseRelName() public static method

Parses RelName r1 as array('RelName', 'r1') or Relname as array('RelName','RelName')
public static parseRelName ( $relName ) : array
return array

query() protected method

Delegates to the finder for querying
protected query ( $sql, $params ) : Query
return Query

set() public method

public set ( $object, $key, $value )

setter() public method

public setter ( $key )

Property Details

$class public_oe property

public $class

$foreign public_oe property

public $foreign

$local public_oe property

public $local