File size: 1,210 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
<?php

declare(strict_types=1);

namespace Option\Domain\Repositories;

use Option\Domain\Entities\OptionEntity;
use Option\Domain\Exceptions\KeyTakenException;
use Option\Domain\Exceptions\OptionNotFoundException;
use Option\Domain\ValueObjects\Key;
use Shared\Domain\Repositories\RepositoryInterface;
use Shared\Domain\ValueObjects\Id;

interface OptionRepositoryInterface extends RepositoryInterface
{
    /**
     * Add new entityt to the repository
     *
     * @param OptionEntity $option
     * @return OptionRepositoryInterface
     * @throws KeyTakenException
     */
    public function add(OptionEntity $option): self;

    /**
     * Remove the entity from the repository
     *
     * @param OptionEntity $option
     * @return OptionRepositoryInterface
     */
    public function remove(OptionEntity $option): self;

    /**
     * Find entity by id
     *
     * @param Id $id
     * @return OptionEntity
     * @throws OptionNotFoundException
     */
    public function ofId(Id $id): OptionEntity;

    /**
     * Find entity by key
     *
     * @param Key $key
     * @return OptionEntity
     * @throws OptionNotFoundException
     */
    public function ofKey(Key $key): OptionEntity;
}