Member
extends BaseMapper
in package
The base mapper to be used for all other mappers. It helps with preventing duplicate Doctrine code. It uses special types to ensure that the returned values are as expected. As {@link LocalisedTextModel} does not have its own mapper, any of such objects can be persisted and/or removed from the base mapper.
Tags
Table of Contents
Properties
- $em : EntityManager
Methods
- __construct() : mixed
- count() : int
- detach() : void
- Detaches an entity from the entity manager causing any changed to be made to the object to be unsaved
- find() : T|null
- findAll() : array<string|int, T>
- findAllWithUserDetails() : array<string|int, Member|User|UserRole|null>
- Fetch all members including their associated user.
- findBirthdayMembers() : array<string|int, Member>
- Find all members with a birthday in the next $days days.
- findBy() : array<string|int, T>
- findByLidnr() : Member|null
- Find a member by its membership number (NOTE: only members who are not deleted are returned).
- findCurrentInstallations() : array<string|int, OrganMember>
- Find all active installations of a member.
- findHistoricalInstallations() : array<string|int, OrganMember>
- Find all past installations of a member.
- findOneBy() : T|null
- findOrgans() : array<string|int, Organ>
- Find all organs of this member.
- flush() : void
- getConnection() : Connection
- Get the entity manager connection.
- getEntityManager() : EntityManager
- Get the entity manager.
- persist() : void
- persistMultiple() : void
- Persist multiple studies.
- remove() : void
- removeById() : void
- Remove an entity by its ID using find
- removeMultiple() : void
- Removes multiple studies.
- searchByName() : array<string|int, array{lidnr: int, fullName: string, generation: int}>
- Finds members (lidnr, full name, and generation) by (part of) their name.
- transactional() : mixed
- Transactional Doctrine wrapper.
- getRepository() : EntityRepository
- Get the repository for this mapper.
- getRepositoryName() : string
Properties
$em read-only
private
EntityManager
$em
Methods
__construct()
public
__construct(EntityManager $em) : mixed
Parameters
- $em : EntityManager
count()
public
count(mixed $criteria) : int
Parameters
- $criteria : mixed
-
The criteria the objects to be counted should satisfy
Return values
int —The number of entities satisfying the criteria
detach()
Detaches an entity from the entity manager causing any changed to be made to the object to be unsaved
public
detach(object $entity) : void
Parameters
- $entity : object
Tags
find()
public
find(mixed $id) : T|null
Parameters
- $id : mixed
-
The ID of the entity to be retrieved using the primary key
Return values
T|null —The entity corresponding to the provided ID or null of the entity cannot be found
findAll()
public
findAll() : array<string|int, T>
Return values
array<string|int, T> —All entities in the repository
findAllWithUserDetails()
Fetch all members including their associated user.
public
findAllWithUserDetails() : array<string|int, Member|User|UserRole|null>
NOTE: The ordering of the return array is not as you might expect. The actual result will be like:
array{ 0: MemberModel, 1: ?UserModel, 2: MemberModel, 3: ... (repeat pattern) }
In other words, every 2 rows represent a single Member
.
Return values
array<string|int, Member|User|UserRole|null>findBirthdayMembers()
Find all members with a birthday in the next $days days.
public
findBirthdayMembers(int $days) : array<string|int, Member>
When $days equals 0 or isn't given, it will give all birthdays of today. We do not show members whose membership has expired or who are hidden
Parameters
- $days : int
-
the number of days to look ahead
Return values
array<string|int, Member> —sorted by birthday
findBy()
public
findBy(mixed $criteria) : array<string|int, T>
Parameters
- $criteria : mixed
-
The criteria that describe the entity to be retrieved
Return values
array<string|int, T> —The entities corresponding to the provided criteria
findByLidnr()
Find a member by its membership number (NOTE: only members who are not deleted are returned).
public
findByLidnr(int $number) : Member|null
Parameters
- $number : int
-
Membership number
Return values
Member|nullfindCurrentInstallations()
Find all active installations of a member.
public
findCurrentInstallations(Member $member) : array<string|int, OrganMember>
Parameters
- $member : Member
Return values
array<string|int, OrganMember>findHistoricalInstallations()
Find all past installations of a member.
public
findHistoricalInstallations(Member $member) : array<string|int, OrganMember>
Parameters
- $member : Member
Return values
array<string|int, OrganMember>findOneBy()
public
findOneBy(array<string|int, mixed> $criteria) : T|null
Parameters
- $criteria : array<string|int, mixed>
-
The criteria that describe the entity to be retrieved
Tags
Return values
T|null —The entity corresponding to the provided criteria or null of the entity cannot be found
findOrgans()
Find all organs of this member.
public
findOrgans(Member $member) : array<string|int, Organ>
Parameters
- $member : Member
Return values
array<string|int, Organ>flush()
public
flush() : void
Tags
getConnection()
Get the entity manager connection.
public
getConnection() : Connection
Return values
ConnectiongetEntityManager()
Get the entity manager.
public
getEntityManager() : EntityManager
Return values
EntityManagerpersist()
public
persist(object $entity) : void
Parameters
- $entity : object
Tags
persistMultiple()
Persist multiple studies.
public
persistMultiple(array<string|int, mixed> $entities) : void
Parameters
- $entities : array<string|int, mixed>
Tags
remove()
public
remove(object $entity) : void
Parameters
- $entity : object
Tags
removeById()
Remove an entity by its ID using find
public
removeById(mixed $id) : void
Parameters
- $id : mixed
Tags
removeMultiple()
Removes multiple studies.
public
removeMultiple(array<string|int, mixed> $entities) : void
Parameters
- $entities : array<string|int, mixed>
Tags
searchByName()
Finds members (lidnr, full name, and generation) by (part of) their name.
public
searchByName(string $name[, int $maxResults = 32 ][, string $orderColumn = 'generation' ][, string $orderDirection = 'DESC' ]) : array<string|int, array{lidnr: int, fullName: string, generation: int}>
Parameters
- $name : string
-
(part of) the full name of a member
- $maxResults : int = 32
- $orderColumn : string = 'generation'
- $orderDirection : string = 'DESC'
Return values
array<string|int, array{lidnr: int, fullName: string, generation: int}>transactional()
Transactional Doctrine wrapper.
public
transactional(Closure $func) : mixed
Instead of the EntityManager, this inserts this Mapper into the function.
Parameters
- $func : Closure
getRepository()
Get the repository for this mapper.
protected
getRepository() : EntityRepository
Tags
Return values
EntityRepositorygetRepositoryName()
protected
getRepositoryName() : string
Return values
string —the name of the entity repository e.g. "User/Model/User"