PHP Class LeanMapper\Result

Author: Vojtěch Kohout
Inheritance: implements Iterator
Show file Open project: tharos/leanmapper Class Usage Examples

Protected Properties

Property Type Description
$mapper leanmapper\IMapper

Public Methods

Method Description
__sleep ( ) : array
__wakeup ( )
addDataEntry ( array $values ) Adds new data entry
addToReferencing ( array $values, string $table, string | null $viaColumn = null, Filtering $filtering = null, string | null $strategy = self::STRATEGY_IN ) Adds new data entry to referencing Result
attach ( mixed $id, string $table )
cleanAddedAndRemovedMeta ( )
cleanReferencedResultsCache ( string | null $table = null, string | null $viaColumn = null ) Cleans in-memory cache with referenced results
cleanReferencingAddedAndRemovedMeta ( string $table, string | null $viaColumn = null, Filtering $filtering = null, string | null $strategy = self::STRATEGY_IN )
cleanReferencingResultsCache ( string | null $table = null, string | null $viaColumn = null ) Cleans in-memory cache with referencing results
createDataDifference ( ) : DataDifference Creates new DataDifference instance relevant to current Result state
createDetachedInstance ( ) : self Creates new detached instance (it means non-persisted)
createInstance ( Row | Row[] $data, string $table, Connection $connection, leanmapper\IMapper $mapper ) : self Creates new common instance (it means persisted)
createReferencingDataDifference ( string $table, string | null $viaColumn = null, Filtering $filtering = null, string | null $strategy = self::STRATEGY_IN ) : DataDifference
current ( ) : mixed
enableSerialization ( Connection $connection )
getData ( integer $id ) : array Returns values of columns of requested row
getDataEntry ( mixed $id, string $key ) : mixed Gets value of given column from row with given id
getMapper ( ) : leanmapper\IMapper | null
getModifiedData ( integer $id ) : array Returns values of columns of requested row that were modified
getProxy ( string $proxyClass ) : ResultProxy
getReferencedRow ( integer $id, string $table, string | null $viaColumn = null, Filtering $filtering = null ) : Row | null Creates new Row instance pointing to requested row in referenced Result
getReferencingRows ( integer $id, string $table, string | null $viaColumn = null, Filtering $filtering = null, string $strategy = null ) : Row[] Creates new array of Row instances pointing to requested row in referencing Result
getRow ( integer $id = null ) : Row | null Creates new Row instance pointing to specific row within Result
hasConnection ( ) : boolean
hasDataEntry ( mixed $id, string $column ) : boolean Tells whether row with given id has given column
isDetached ( ) : boolean Tells whether Result is in detached state (in means non-persisted)
isModified ( integer $id ) : boolean Tells whether requested row is in modified state
key ( ) : integer
markAsUpdated ( integer $id ) Marks requested row as non-modified (isModified returns false right after this method call)
next ( )
removeDataEntry ( array $values ) Removes given data entry
removeFromReferencing ( array $values, string $table, string | null $viaColumn = null, Filtering $filtering = null, string | null $strategy = self::STRATEGY_IN ) Remove given data entry from referencing Result
rewind ( )
setConnection ( Connection $connection )
setDataEntry ( mixed $id, string $key, mixed $value ) Sets value of given column in row with given id
setMapper ( leanmapper\IMapper $mapper )
setReferencedResult ( self $referencedResult, string $table, string $viaColumn = null )
setReferencingResult ( self $referencingResult, string $table, string $viaColumn = null, string $strategy = self::STRATEGY_IN )
unsetDataEntry ( mixed $id, string $column ) Unsets given column in row with given id
valid ( ) : boolean

Private Methods

Method Description
__construct ( array $data = null, string | null $table = null, Connection $connection = null, leanmapper\IMapper $mapper = null )
applyFiltering ( Fluent $statement, Filtering $filtering ) : FilteringResult | null
buildUnionStrategySql ( array $ids, string $table, string $viaColumn, Filtering $filtering = null ) : mixed
calculateArgumentsHash ( array $arguments ) : string
createTableSelection ( string $table, array $relatedKeys = null ) : Fluent
extractIds ( string $column ) : array
getReferencedResult ( string $table, string $viaColumn, Filtering $filtering = null ) : self
getReferencingResult ( string $table, string $viaColumn = null, Filtering $filtering = null, string $strategy = self::STRATEGY_IN ) : self
isAlias ( string $column ) : boolean
translateStrategy ( string | null $strategy ) : string
trimAlias ( string $column ) : string

Method Details

__sleep() public method

public __sleep ( ) : array
return array

__wakeup() public method

public __wakeup ( )

addDataEntry() public method

Adds new data entry
public addDataEntry ( array $values )
$values array

addToReferencing() public method

Adds new data entry to referencing Result
public addToReferencing ( array $values, string $table, string | null $viaColumn = null, Filtering $filtering = null, string | null $strategy = self::STRATEGY_IN )
$values array
$table string
$viaColumn string | null
$filtering Filtering
$strategy string | null

attach() public method

public attach ( mixed $id, string $table )
$id mixed
$table string

cleanAddedAndRemovedMeta() public method

cleanReferencedResultsCache() public method

Cleans in-memory cache with referenced results
public cleanReferencedResultsCache ( string | null $table = null, string | null $viaColumn = null )
$table string | null
$viaColumn string | null

cleanReferencingAddedAndRemovedMeta() public method

public cleanReferencingAddedAndRemovedMeta ( string $table, string | null $viaColumn = null, Filtering $filtering = null, string | null $strategy = self::STRATEGY_IN )
$table string
$viaColumn string | null
$filtering Filtering
$strategy string | null

cleanReferencingResultsCache() public method

Cleans in-memory cache with referencing results
public cleanReferencingResultsCache ( string | null $table = null, string | null $viaColumn = null )
$table string | null
$viaColumn string | null

createDataDifference() public method

Creates new DataDifference instance relevant to current Result state
public createDataDifference ( ) : DataDifference
return DataDifference

createDetachedInstance() public static method

Creates new detached instance (it means non-persisted)
public static createDetachedInstance ( ) : self
return self

createInstance() public static method

Creates new common instance (it means persisted)
public static createInstance ( Row | Row[] $data, string $table, Connection $connection, leanmapper\IMapper $mapper ) : self
$data Dibi\Row | Dibi\Row[]
$table string
$connection Connection
$mapper leanmapper\IMapper
return self

createReferencingDataDifference() public method

public createReferencingDataDifference ( string $table, string | null $viaColumn = null, Filtering $filtering = null, string | null $strategy = self::STRATEGY_IN ) : DataDifference
$table string
$viaColumn string | null
$filtering Filtering
$strategy string | null
return DataDifference

current() public method

public current ( ) : mixed
return mixed

enableSerialization() public static method

public static enableSerialization ( Connection $connection )
$connection Connection

getData() public method

Returns values of columns of requested row
public getData ( integer $id ) : array
$id integer
return array

getDataEntry() public method

Gets value of given column from row with given id
public getDataEntry ( mixed $id, string $key ) : mixed
$id mixed
$key string
return mixed

getMapper() public method

public getMapper ( ) : leanmapper\IMapper | null
return leanmapper\IMapper | null

getModifiedData() public method

Returns values of columns of requested row that were modified
public getModifiedData ( integer $id ) : array
$id integer
return array

getProxy() public method

public getProxy ( string $proxyClass ) : ResultProxy
$proxyClass string
return ResultProxy

getReferencedRow() public method

Creates new Row instance pointing to requested row in referenced Result
public getReferencedRow ( integer $id, string $table, string | null $viaColumn = null, Filtering $filtering = null ) : Row | null
$id integer
$table string
$viaColumn string | null
$filtering Filtering
return Row | null

getReferencingRows() public method

Creates new array of Row instances pointing to requested row in referencing Result
public getReferencingRows ( integer $id, string $table, string | null $viaColumn = null, Filtering $filtering = null, string $strategy = null ) : Row[]
$id integer
$table string
$viaColumn string | null
$filtering Filtering
$strategy string
return Row[]

getRow() public method

Creates new Row instance pointing to specific row within Result
public getRow ( integer $id = null ) : Row | null
$id integer
return Row | null

hasConnection() public method

public hasConnection ( ) : boolean
return boolean

hasDataEntry() public method

Tells whether row with given id has given column
public hasDataEntry ( mixed $id, string $column ) : boolean
$id mixed
$column string
return boolean

isDetached() public method

Tells whether Result is in detached state (in means non-persisted)
public isDetached ( ) : boolean
return boolean

isModified() public method

Tells whether requested row is in modified state
public isModified ( integer $id ) : boolean
$id integer
return boolean

key() public method

public key ( ) : integer
return integer

markAsUpdated() public method

Marks requested row as non-modified (isModified returns false right after this method call)
public markAsUpdated ( integer $id )
$id integer

next() public method

public next ( )

removeDataEntry() public method

Removes given data entry
public removeDataEntry ( array $values )
$values array

removeFromReferencing() public method

Remove given data entry from referencing Result
public removeFromReferencing ( array $values, string $table, string | null $viaColumn = null, Filtering $filtering = null, string | null $strategy = self::STRATEGY_IN )
$values array
$table string
$viaColumn string | null
$filtering Filtering
$strategy string | null

rewind() public method

public rewind ( )

setConnection() public method

public setConnection ( Connection $connection )
$connection Connection

setDataEntry() public method

Sets value of given column in row with given id
public setDataEntry ( mixed $id, string $key, mixed $value )
$id mixed
$key string
$value mixed

setMapper() public method

public setMapper ( leanmapper\IMapper $mapper )
$mapper leanmapper\IMapper

setReferencedResult() public method

public setReferencedResult ( self $referencedResult, string $table, string $viaColumn = null )
$referencedResult self
$table string
$viaColumn string

setReferencingResult() public method

public setReferencingResult ( self $referencingResult, string $table, string $viaColumn = null, string $strategy = self::STRATEGY_IN )
$referencingResult self
$table string
$viaColumn string
$strategy string

unsetDataEntry() public method

Unsets given column in row with given id
public unsetDataEntry ( mixed $id, string $column )
$id mixed
$column string

valid() public method

public valid ( ) : boolean
return boolean

Property Details

$mapper protected property

protected IMapper,leanmapper $mapper
return leanmapper\IMapper