File size: 1,443 Bytes
cf14c12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | <?php
declare(strict_types=1);
namespace Shared\Domain\Repositories;
use Countable;
use Iterator;
use IteratorAggregate;
use Shared\Domain\ValueObjects\MaxResults;
/**
* Base repository interface.
*
* This interface consist of the common methods which might be availabke in
* actual repository interfaces. Repositories should not implement this
* interface directly. Actualy repository interfaces may extend this interface.
*/
interface RepositoryInterface extends IteratorAggregate, Countable
{
/**
* Returns the iterator of the collection after applying the filters
*
* @return Iterator
*/
public function getIterator(): Iterator;
/**
* Return a slice of the collection
*
* @param int $start
* @param int $size
* @return RepositoryInterface
*/
public function slice(int $start, int $size = 20): self;
/**
* Count entities in the filtered collection
*
* @return int
*/
public function count(): int;
/**
* Flushes all changes to objects that have been queued up to now to the
* database. This effectively synchronizes the in-memory state of managed
* objects with permanent storage such as database.
*
* @return void
*/
public function flush(): void;
/**
* @param MaxResults $maxResults
* @return static
*/
public function setMaxResults(MaxResults $maxResults): static;
}
|