Overview

Namespaces

  • LeanMapper
    • Exception
    • Reflection
    • Relationship

Classes

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

Class Repository

Base class for custom repositories

Abstract
Namespace: LeanMapper
Author: Vojtěch Kohout
Located at Repository.php
Methods summary
public
# __construct( DibiConnection $connection )

Parameters

$connection
public integer
# persist( LeanMapper\Entity $entity )

Stores modified fields of entity into database or creates new row in database when entity is in detached state

Stores modified fields of entity into database or creates new row in database when entity is in detached state

Parameters

$entity

Returns

integer
public
# delete( LeanMapper\Entity|integer $arg )

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

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

Parameters

$arg

Throws

LeanMapper\Exception\InvalidStateException
protected array
# beforeCreate( array $values )

Adjusts prepared values before database insert call

Adjusts prepared values before database insert call

Parameters

$values

Returns

array
protected array
# beforeUpdate( array $values )

Adjusts prepared values before database update call

Adjusts prepared values before database update call

Parameters

$values

Returns

array
protected array
# beforePersist( array $values )

Adjusts prepared values before database insert or update call

Adjusts prepared values before database insert or update call

Parameters

$values

Returns

array
protected mixed
# createEntity( DibiRow $row, string|null $entityClass = null, string|null $table = null )

Helps to create entity instance from given DibiRow instance

Helps to create entity instance from given DibiRow instance

Parameters

$row
$entityClass
$table

Returns

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

Helps to create array of entities from given array of DibiRow instances

Helps to create array of entities from given array of DibiRow instances

Parameters

$rows
$entityClass
$table

Returns

array
protected string
# getTable( )

Returns name of database table related to entity which repository can handle

Returns name of database table related to entity which repository can handle

Returns

string

Throws

LeanMapper\Exception\InvalidStateException
protected string
# getEntityClass( )

Returns fully qualified name of entity class which repository can handle

Returns fully qualified name of entity class which repository can handle

Returns

string

Throws

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

Parameters

$entity

Throws

LeanMapper\Exception\InvalidArgumentException
protected array
# createCollection( array $entities )

Parameters

$entities

Returns

array
Properties summary
protected string $defaultEntityNamespace
# 'Model\Entity'
protected DibiConnection $connection
#
protected string $table
#
protected string $entityClass
#
tharos/leanmapper v1.4.0 API documentation API documentation generated by ApiGen