type fixes

This commit is contained in:
Yuri Kuznetsov
2021-11-08 15:22:49 +02:00
parent ac57f6a39a
commit ab9f78d33f
2 changed files with 13 additions and 1 deletions

View File

@@ -224,6 +224,9 @@ class Service implements Crud,
$this->entityType = $entityType;
}
/**
* @phpstan-return RDBRepository<TEntity>
*/
protected function getRepository(): RDBRepository
{
return $this->entityManager->getRDBRepository($this->entityType);
@@ -288,6 +291,8 @@ class Service implements Crud,
* Get an entity by ID. Access control check is performed.
*
* @throws ForbiddenSilent If no read access.
*
* @phpstan-return TEntity|null
*/
public function getEntity(string $id): ?Entity
{
@@ -820,9 +825,13 @@ class Service implements Crud,
return $this->injectableFactory->create(ApplierClassNameListProvider::class);
}
/**
* @phpstan-return TEntity|null
*/
protected function getEntityEvenDeleted(string $id): ?Entity
{
$query = $this->entityManager->getQueryBuilder()
$query = $this->entityManager
->getQueryBuilder()
->select()
->from($this->entityType)
->where([

View File

@@ -732,6 +732,7 @@ class RDBRepository implements Repository
throw new RuntimeException("Can't clone a query of a different entity type.");
}
/** @var RDBSelectBuilder<TEntity> */
$builder = new RDBSelectBuilder($this->entityManager, $this->entityType, $query);
return $builder;
@@ -892,6 +893,8 @@ class RDBRepository implements Repository
* * `groupBy([$expr1, $expr2, ...])`
*
* @param Expression|Expression[]|string|string[] $groupBy
*
* @phpstan-return RDBSelectBuilder<TEntity>
*/
public function group($groupBy): RDBSelectBuilder
{