type fixes

This commit is contained in:
Yuri Kuznetsov
2021-11-03 16:34:18 +02:00
parent 48ca9259af
commit fd22f50de2
11 changed files with 111 additions and 38 deletions
@@ -33,26 +33,36 @@ use Espo\ORM\Entity;
/**
* An access point for fetching and storing records.
*
* @template T of Entity
*/
interface Repository
{
/**
* Get a new entity.
*
* @phpstan-return T
*/
public function getNew(): Entity;
/**
* Fetch an entity by ID.
*
* @phpstan-return ?T
*/
public function getById(string $id): ?Entity;
/**
* Store an entity.
*
* @phpstan-param T $entity
*/
public function save(Entity $entity, array $options = []): void;
/**
* Remove an entity.
*
* @phpstan-param T $entity
*/
public function remove(Entity $entity, array $options = []): void;
}