Overview

Namespaces

  • LeanMapper
    • Exception
    • Reflection
    • Relationship

Classes

  • Connection
  • DataDifference
  • DefaultMapper
  • Entity
  • Events
  • Filtering
  • Fluent
  • Repository
  • Result
  • Row

Interfaces

  • IMapper
  • Overview
  • Namespace
  • Class

Class Result

Set of related data, heart of Lean Mapper

LeanMapper\Result implements Iterator
Namespace: LeanMapper
Author: Vojtěch Kohout
Located at Result.php
Methods summary
public static LeanMapper\Result
# getInstance( DibiRow|DibiRow[] $data, string $table, LeanMapper\Connection $connection, LeanMapper\IMapper $mapper, string|null $originKey = null )

Creates new common instance (it means persisted)

Creates new common instance (it means persisted)

Parameters

$data
$table
$connection
$mapper
$originKey

Returns

LeanMapper\Result

Throws

LeanMapper\Exception\InvalidArgumentException
public static LeanMapper\Result
# getDetachedInstance( )

Creates new detached instance (it means non-persisted)

Creates new detached instance (it means non-persisted)

Returns

LeanMapper\Result
public
# setMapper( LeanMapper\IMapper $mapper )

Parameters

$mapper
public LeanMapper\IMapper|null
# getMapper( )

Returns

LeanMapper\IMapper|null
public string|null
# getOriginKey( )

Returns

string|null
public LeanMapper\Row|null
# getRow( integer $id = 0 )

Creates new Row instance pointing to specific row within Result

Creates new Row instance pointing to specific row within Result

Parameters

$id

Returns

LeanMapper\Row|null
public mixed
# getDataEntry( mixed $id, string $key )

Gets value of given column from row with given id

Gets value of given column from row with given id

Parameters

$id
$key

Returns

mixed

Throws

LeanMapper\Exception\InvalidArgumentException
public
# setDataEntry( mixed $id, string $key, mixed $value )

Sets value of given column in row with given id

Sets value of given column in row with given id

Parameters

$id
$key
$value

Throws

LeanMapper\Exception\InvalidArgumentException
public boolean
# hasDataEntry( mixed $id, string $column )

Tells whether row with given id has given column

Tells whether row with given id has given column

Parameters

$id
$column

Returns

boolean
public
# unsetDataEntry( mixed $id, string $column )

Unsets given column in row with given id

Unsets given column in row with given id

Parameters

$id
$column

Throws

LeanMapper\Exception\InvalidArgumentException
public
# addDataEntry( array $values )

Adds new data entry

Adds new data entry

Parameters

$values
public
# removeDataEntry( array $values )

Removes given data entry

Removes given data entry

Parameters

$values

Throws

LeanMapper\Exception\InvalidArgumentException
public array
# getData( integer $id )

Returns values of columns of requested row

Returns values of columns of requested row

Parameters

$id

Returns

array
public array
# getModifiedData( integer $id )

Returns values of columns of requested row that were modified

Returns values of columns of requested row that were modified

Parameters

$id

Returns

array
public LeanMapper\DataDifference
# createDataDifference( )

Creates new DataDifference instance relevant to current Result state

Creates new DataDifference instance relevant to current Result state

Returns

LeanMapper\DataDifference
public boolean
# isModified( integer $id )

Tells whether requested row is in modified state

Tells whether requested row is in modified state

Parameters

$id

Returns

boolean
public boolean
# isDetached( )

Tells whether Result is in detached state (in means non-persisted)

Tells whether Result is in detached state (in means non-persisted)

Returns

boolean
public
# markAsUpdated( integer $id )

Marks requested row as non-modified (isModified returns false right after this method call)

Marks requested row as non-modified (isModified returns false right after this method call)

Parameters

$id

Throws

LeanMapper\Exception\InvalidMethodCallException
public
# markAsAttached( mixed $newId, mixed $oldId, string $table, LeanMapper\Connection $connection )

Marks requested row as attached

Marks requested row as attached

Parameters

$newId
$oldId
$table
$connection

Throws

LeanMapper\Exception\InvalidStateException
public
# cleanAddedAndRemovedMeta( )
public LeanMapper\Row|null
# getReferencedRow( integer $id, string $table, string|null $viaColumn = null, LeanMapper\Filtering $filtering = null )

Creates new Row instance pointing to requested row in referenced Result

Creates new Row instance pointing to requested row in referenced Result

Parameters

$id
$table
$viaColumn
$filtering

Returns

LeanMapper\Row|null

Throws

LeanMapper\Exception\InvalidStateException
public LeanMapper\Row[]
# getReferencingRows( integer $id, string $table, string|null $viaColumn = null, LeanMapper\Filtering $filtering = null, string $strategy = null )

Creates new array of Row instances pointing to requested row in referencing Result

Creates new array of Row instances pointing to requested row in referencing Result

Parameters

$id
$table
$viaColumn
$filtering
$strategy

Returns

LeanMapper\Row[]

Throws

LeanMapper\Exception\InvalidStateException
public
# addToReferencing( array $values, string $table, string|null $viaColumn = null, LeanMapper\Filtering $filtering = null, string|null $strategy = self::STRATEGY_IN )

Adds new data entry to referencing Result

Adds new data entry to referencing Result

Parameters

$values
$table
$viaColumn
$filtering
$strategy
public
# removeFromReferencing( array $values, string $table, string|null $viaColumn = null, LeanMapper\Filtering $filtering = null, string|null $strategy = self::STRATEGY_IN )

Remove given data entry from referencing Result

Remove given data entry from referencing Result

Parameters

$values
$table
$viaColumn
$filtering
$strategy
public LeanMapper\DataDifference
# createReferencingDataDifference( string $table, string|null $viaColumn = null, LeanMapper\Filtering $filtering = null, string|null $strategy = self::STRATEGY_IN )

Parameters

$table
$viaColumn
$filtering
$strategy

Returns

LeanMapper\DataDifference
public
# cleanReferencedResultsCache( string|null $table = null, string|null $viaColumn = null )

Cleans in-memory cache with referenced results

Cleans in-memory cache with referenced results

Parameters

$table
$viaColumn
public
# cleanReferencingResultsCache( string|null $table = null, string|null $viaColumn = null )

Cleans in-memory cache with referencing results

Cleans in-memory cache with referencing results

Parameters

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

Parameters

$table
$viaColumn
$filtering
$strategy
public mixed
# current( )

Returns

mixed

Implementation of

Iterator::current()
public
# next( )

Implementation of

Iterator::next()
public integer
# key( )

Returns

integer

Implementation of

Iterator::key()
public boolean
# valid( )

Returns

boolean

Implementation of

Iterator::valid()
public
# rewind( )

Implementation of

Iterator::rewind()
Constants summary
string STRATEGY_IN
# 'in'
string STRATEGY_UNION
# 'union'
Properties summary
protected LeanMapper\IMapper $mapper
#
tharos/leanmapper v2.0.1 API documentation API documentation generated by ApiGen