class EntityRelationshipRepository extends EntityRepository

Class EntityRelationshipRepository is injected as empire_entity_relationship_plugin.repository service. EntityRelationshipRepository is used for crud operation for entity.

Use this class to work with database.

Traits

Trait JQGridTrait
Class BaseRepositoryTrait. Used to provide generic CRUD operations for PrimaryKeyInterface entities

Constants

ALIAS

Alias for main entity

ENTITY_ALIAS

Generic entity alias

Methods

jQGridJoinFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

All joins used in select.

jQGridGroupByFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

Should contain group by which jqgrid uses.

array
findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams, JQGridWrapper $jqGridWrapper)

JQGrid function

array
searchForJQGRID(array $searchParams, array $sortParams, bool $isCountSearch = false, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

JQGrid function

save(PrimaryKeyInterface $object)

Save PrimaryKeyInterface entity

edit(PrimaryKeyInterface $object)

Edit PrimaryKeyInterface entity

bool
remove(PrimaryKeyInterface $object)

Delete PrimaryKeyInterface entity

boolean
deleteMultipleByIds(array $ids)

Delete multiple PrimaryKeyInterface entities by array of ids

boolean|string
deleteMultipleByField(string $field, array $values)

Delete multiple PrimaryKeyInterface entities by values of field

mixed
getReference(int $id, string|null $class = null)

Get reference to class

bool|string
saveMultiple(array $elements, int $flushNumber = 30)

Save multiple entities

bool|string
updateMultiple(array $elements, int $flushNumber = 30)

Edit multiple entities

bool|string
deleteMultiple(array $elements, int $flushNumber = 30)

Delete multiple enities

array
getAllEntities()

Get all entities that implement RelationshipEntityInterface

array
getPropertiesForClass(string $class)

Get all properties of specified class

array
searchEntity(string $class, string $field, string $view, string $query, int $page = 1, int $offset = 10)

Search specified class

array
selectEntity(string $class, string $view, array $ids)

Get all specified elements

bool
checkEntityTypesCombination(EntityRelationship $relationship)

Check if relationship can be added. One relationship name can only be used in one combination of main and sub entities

array
getEntityRelationshipNames()

Get all distinct relationship names

array
getRelationshipData(string $title, array $ids, bool $includeIdsFromSubEntities = false, bool $strictNameCheck = true)

Get data for relationship based on title and ids

array
getFromDB(array $data, array $dataForJoin = [])

Get all data from database

string|array
getEntityDataForParams(string $class, array $paramBag, bool $selectIdsOnly = false)

Get ids of class for specified array of params

Details

in JQGridTrait at line 27
jQGridJoinFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

All joins used in select.

Override in the repository class if needed. Should do nothing otherwise

Parameters

QueryBuilder $qb
JQGridWrapper $jqGridWrapper

in JQGridTrait at line 42
jQGridGroupByFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

Should contain group by which jqgrid uses.

Override in the repository class if needed. Should do nothing otherwise

Parameters

QueryBuilder $qb
JQGridWrapper $jqGridWrapper

in JQGridTrait at line 61
array findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams, JQGridWrapper $jqGridWrapper)

JQGrid function

Parameters

int $page
int $offset
array $sortParams
array $additionalParams
JQGridWrapper $jqGridWrapper

Return Value

array

in JQGridTrait at line 94
array searchForJQGRID(array $searchParams, array $sortParams, bool $isCountSearch = false, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

JQGrid function

Parameters

array $searchParams
array $sortParams
bool $isCountSearch
array $additionalParams
JQGridWrapper $jqGridWrapper

Return Value

array

in BaseRepositoryTrait at line 27
PrimaryKeyInterface save(PrimaryKeyInterface $object)

Save PrimaryKeyInterface entity

Parameters

PrimaryKeyInterface $object

Return Value

PrimaryKeyInterface

in BaseRepositoryTrait at line 48
PrimaryKeyInterface edit(PrimaryKeyInterface $object)

Edit PrimaryKeyInterface entity

Parameters

PrimaryKeyInterface $object

Return Value

PrimaryKeyInterface

in BaseRepositoryTrait at line 69
bool remove(PrimaryKeyInterface $object)

Delete PrimaryKeyInterface entity

Parameters

PrimaryKeyInterface $object

Return Value

bool FALSE on error, TRUE otherwise

in BaseRepositoryTrait at line 88
boolean deleteMultipleByIds(array $ids)

Delete multiple PrimaryKeyInterface entities by array of ids

Parameters

array $ids

Return Value

boolean

in BaseRepositoryTrait at line 101
boolean|string deleteMultipleByField(string $field, array $values)

Delete multiple PrimaryKeyInterface entities by values of field

Parameters

string $field
  • Field which will be checked
array $values
  • Values to be deleted

Return Value

boolean|string

in BaseRepositoryTrait at line 130
mixed getReference(int $id, string|null $class = null)

Get reference to class

Parameters

int $id
  • Id og reference
string|null $class
  • Class of reference

Return Value

mixed

in BaseRepositoryTrait at line 143
bool|string saveMultiple(array $elements, int $flushNumber = 30)

Save multiple entities

Parameters

array $elements
int $flushNumber

Return Value

bool|string

in BaseRepositoryTrait at line 178
bool|string updateMultiple(array $elements, int $flushNumber = 30)

Edit multiple entities

Parameters

array $elements
int $flushNumber

Return Value

bool|string

in BaseRepositoryTrait at line 213
bool|string deleteMultiple(array $elements, int $flushNumber = 30)

Delete multiple enities

Parameters

array $elements
int $flushNumber

Return Value

bool|string

at line 53
array getAllEntities()

Get all entities that implement RelationshipEntityInterface

Return Value

array

Exceptions

ReflectionException

See also

RelationshipEntityInterface

at line 77
array getPropertiesForClass(string $class)

Get all properties of specified class

Parameters

string $class

Return Value

array

at line 105
array searchEntity(string $class, string $field, string $view, string $query, int $page = 1, int $offset = 10)

Search specified class

Parameters

string $class
  • Class to search
string $field
  • Field to search
string $view
  • Display results as
string $query
  • Query string
int $page
  • Page of data
int $offset
  • Number of items per page

Return Value

array

Exceptions

MappingException

at line 138
array selectEntity(string $class, string $view, array $ids)

Get all specified elements

Parameters

string $class
  • Class to search
string $view
  • Field to view as results
array $ids
  • ids of elements to display

Return Value

array

at line 162
bool checkEntityTypesCombination(EntityRelationship $relationship)

Check if relationship can be added. One relationship name can only be used in one combination of main and sub entities

Parameters

EntityRelationship $relationship

Return Value

bool

Exceptions

NoResultException
NonUniqueResultException

at line 179
array getEntityRelationshipNames()

Get all distinct relationship names

Return Value

array

at line 199
array getRelationshipData(string $title, array $ids, bool $includeIdsFromSubEntities = false, bool $strictNameCheck = true)

Get data for relationship based on title and ids

Parameters

string $title
array $ids
bool $includeIdsFromSubEntities
bool $strictNameCheck

Return Value

array

Exceptions

DBALException

at line 253
array getFromDB(array $data, array $dataForJoin = [])

Get all data from database

Parameters

array $data
array $dataForJoin

Return Value

array

at line 285
string|array getEntityDataForParams(string $class, array $paramBag, bool $selectIdsOnly = false)

Get ids of class for specified array of params

Parameters

string $class
array $paramBag
bool $selectIdsOnly

Return Value

string|array

Exceptions

NonUniqueResultException