Overview

Namespaces

  • LeanMapper
    • Exception
    • Reflection
    • Relationship

Classes

  • Entity
  • Repository
  • Result
  • Row
  • Overview
  • Namespace
  • Class

Class Result

Set of related data

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, DibiConnection $connection )

Creates new common instance (it means persisted)

Creates new common instance (it means persisted)

Parameters

$data
$table
$connection

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 LeanMapper\Row|null
# getRow( integer $id = 0 )

Creates new LeanMapper\Row instance pointing to requested row in LeanMapper\Result

Creates new LeanMapper\Row instance pointing to requested row in LeanMapper\Result

Parameters

$id

Returns

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

Returns data of given field from row with given id

Returns data of given field from row with given id

Parameters

$id
$key

Returns

mixed

Throws

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

Sets data of given field in row with given id

Sets data of given field in row with given id

Parameters

$id
$key
$value

Throws

LeanMapper\Exception\InvalidArgumentException
public boolean
# isModified( integer $id )

Tells whether requested row is modified state

Tells whether requested row is modified state

Parameters

$id

Returns

boolean
public boolean
# isDetached( integer $id )

Tells whether requested row is in detached state (like newly created row)

Tells whether requested row is in detached state (like newly created row)

Parameters

$id

Returns

boolean
public
# detach( integer $id )

Marks requested row as detached (it means non-persisted)

Marks requested row as detached (it means non-persisted)

Parameters

$id

Throws

LeanMapper\Exception\InvalidArgumentException
public
# markAsUpdated( integer $id )

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

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

Parameters

$id
public
# markAsCreated( integer $newId, integer $oldId, string $table, DibiConnection $connection )

Marks requested row as persisted

Marks requested row as persisted

Parameters

$newId
$oldId
$table
$connection

Throws

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

Returns array of fields of requested row

Returns array of fields of requested row

Parameters

$id

Returns

array
public array
# getModifiedData( integer $id )

Returns array of modified fields of requested row with new values

Returns array of modified fields of requested row with new values

Parameters

$id

Returns

array
public LeanMapper\Row|null
# getReferencedRow( integer $id, string $table, Closure $filter = null, string|null $viaColumn = null )

Creates new LeanMapper\Row instance pointing to requested row in referenced result

Creates new LeanMapper\Row instance pointing to requested row in referenced result

Parameters

$id
$table
$filter
$viaColumn

Returns

LeanMapper\Row|null

Throws

LeanMapper\Exception\InvalidStateException
public LeanMapper\Row[]
# getReferencingRows( integer $id, string $table, Closure $filter = null, string|null $viaColumn = null, string $strategy = self::STRATEGY_IN )

Creates new array of LeanMapper\Row instances pointing to requested row in referencing result

Creates new array of LeanMapper\Row instances pointing to requested row in referencing result

Parameters

$id
$table
$filter
$viaColumn
$strategy

Returns

LeanMapper\Row[]

Throws

LeanMapper\Exception\InvalidArgumentException
LeanMapper\Exception\InvalidStateException
public
# cleanReferencedResultsCache( string|null $table = null, string|null $column = null )

Clean in-memory cache of referenced results

Clean in-memory cache of referenced results

Parameters

$table
$column
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'
tharos/leanmapper v1.4.0 API documentation API documentation generated by ApiGen