PHP Class Spot\Relation\RelationAbstract

Show file Open project: vlucas/spot2 Class Usage Examples

Protected Properties

Property Type Description
$entityName
$foreignKey
$identityValue
$localKey
$mapper
$query
$queryQueue
$result

Public Methods

Method Description
__call ( $func, $args ) Passthrough for missing methods on expected object result
eagerLoadOnCollection ( $relationName, Collection $collection ) : Spot\Collection Map relation results to original collection of entities
entityKey ( ) : string Get entity key field - defaults to the primary key
entityName ( ) : string Get entity name object
execute ( ) Execute query and return results
foreignKey ( ) : string Get foreign key field
identityValue ( $identityValue = null ) : mixed Get identity value
identityValuesFromCollection ( Collection $collection ) Set identity values from given collection
localKey ( ) : string Get local key field
mapper ( ) : Mapper Get Mapper object
query ( ) Get query object instance
save ( Spot\EntityInterface $entity, string $relationName, array $options = [] ) : boolean Save related entities

Protected Methods

Method Description
buildQuery ( ) : Query Build query object

Method Details

__call() public method

Passthrough for missing methods on expected object result
public __call ( $func, $args )

buildQuery() abstract protected method

Build query object
abstract protected buildQuery ( ) : Query
return Spot\Query

eagerLoadOnCollection() public method

Map relation results to original collection of entities
public eagerLoadOnCollection ( $relationName, Collection $collection ) : Spot\Collection
$collection Spot\Entity\Collection
return Spot\Collection

entityKey() public method

Get entity key field - defaults to the primary key
public entityKey ( ) : string
return string

entityName() public method

Get entity name object
public entityName ( ) : string
return string

execute() public method

Execute query and return results
public execute ( )

foreignKey() public method

Get foreign key field
public foreignKey ( ) : string
return string

identityValue() public method

Get identity value
public identityValue ( $identityValue = null ) : mixed
return mixed Array, string, or id

identityValuesFromCollection() abstract public method

Set identity values from given collection
abstract public identityValuesFromCollection ( Collection $collection )
$collection Spot\Entity\Collection

localKey() public method

Get local key field
public localKey ( ) : string
return string

mapper() public method

Get Mapper object
public mapper ( ) : Mapper
return Spot\Mapper

query() public method

Get query object instance
public query ( )

save() abstract public method

Save related entities
abstract public save ( Spot\EntityInterface $entity, string $relationName, array $options = [] ) : boolean
$entity Spot\EntityInterface Entity to save relation from
$relationName string Name of the relation to save
$options array Options to pass to the mappers
return boolean

Property Details

$entityName protected property

protected $entityName

$foreignKey protected property

protected $foreignKey

$identityValue protected property

protected $identityValue

$localKey protected property

protected $localKey

$mapper protected property

protected $mapper

$query protected property

protected $query

$queryQueue protected property

protected $queryQueue

$result protected property

protected $result