Overview

Namespaces

  • LeanMapper
    • Exception
    • Reflection
    • Relationship

Classes

  • Caller
  • Connection
  • DataDifference
  • DefaultEntityFactory
  • DefaultMapper
  • Entity
  • Events
  • Filtering
  • FilteringResult
  • FilteringResultDecorator
  • Fluent
  • ImplicitFilters
  • Repository
  • Result
  • ResultProxy
  • Row

Interfaces

  • IEntityFactory
  • IMapper
  • Overview
  • Namespace
  • Class

Class Repository

Base class for concrete repositories

Abstract
Namespace: LeanMapper
Author: Vojtěch Kohout
Located at Repository.php
Methods summary
public
# __construct( LeanMapper\Connection $connection, LeanMapper\IMapper $mapper, LeanMapper\IEntityFactory $entityFactory )

Parameters

$connection
$mapper
$entityFactory
public array|null &
# __get( string $name )

Parameters

$name

Returns

array|null
protected LeanMapper\Fluent
# createFluent( )

Returns

LeanMapper\Fluent
protected
# initEvents( )

Allows initialize repository's events

Allows initialize repository's events

public mixed
# persist( LeanMapper\Entity $entity )

Stores values of entity's modified properties into database (inserts new row when entity is in detached state)

Stores values of entity's modified properties into database (inserts new row when entity is in detached state)

Parameters

$entity

Returns

mixed
public mixed
# delete( mixed $arg )

Removes given entity (or entity with given id) from database

Removes given entity (or entity with given id) from database

Parameters

$arg

Returns

mixed

Throws

LeanMapper\Exception\InvalidStateException
protected mixed
# insertIntoDatabase( LeanMapper\Entity $entity )

Performs database insert (can be customized)

Performs database insert (can be customized)

Parameters

$entity

Returns

mixed
protected mixed
# updateInDatabase( LeanMapper\Entity $entity )

Performs database update (can be customized)

Performs database update (can be customized)

Parameters

$entity

Returns

mixed
protected mixed
# deleteFromDatabase( mixed $arg )

Performs database delete (can be customized)

Performs database delete (can be customized)

Parameters

$arg

Returns

mixed
protected
# persistHasManyChanges( LeanMapper\Entity $entity )

Persists changes in M:N relationships

Persists changes in M:N relationships

Parameters

$entity
protected mixed
# createEntity( DibiRow $dibiRow, string|null $entityClass = null, string|null $table = null )

Creates new Entity instance from given DibiRow instance

Creates new Entity instance from given DibiRow instance

Parameters

$dibiRow
$entityClass
$table

Returns

mixed
protected array
# createEntities( array $rows, string|null $entityClass = null, string|null $table = null )

Creates new set of Entity's instances from given array of DibiRow instances

Creates new set of Entity's instances from given array of DibiRow instances

Parameters

$rows
$entityClass
$table

Returns

array
protected string
# getTable( )

Gets name of (main) database table related to entity that repository can handle

Gets name of (main) database table related to entity that repository can handle

Returns

string

Throws

LeanMapper\Exception\InvalidStateException
protected
# checkEntityType( LeanMapper\Entity $entity )

Checks whether give entity is instance of required type

Checks whether give entity is instance of required type

Parameters

$entity

Throws

LeanMapper\Exception\InvalidArgumentException
Properties summary
protected LeanMapper\Connection $connection
#
protected LeanMapper\IMapper $mapper
#
protected LeanMapper\IEntityFactory $entityFactory
#
protected string $table
#
protected string $entityClass
#
protected LeanMapper\Events $events
#
tharos/leanmapper v2.3.0 API documentation API documentation generated by ApiGen