1 | <?php |
||
24 | class IdentityMap implements IdentityMapInterface |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * @var CacheStorageInterface |
||
29 | */ |
||
30 | protected $cache; |
||
31 | |||
32 | /** |
||
33 | * Set an entity |
||
34 | * |
||
35 | * @param EntityInterface $entity |
||
36 | * |
||
37 | * @return self|$this|IdentityMapInterface |
||
38 | */ |
||
39 | public function set(EntityInterface $entity) |
||
44 | |||
45 | /** |
||
46 | * Gets the entity with provided id |
||
47 | * |
||
48 | * @param mixed $entityId |
||
49 | * |
||
50 | * @param null $default |
||
51 | * |
||
52 | * @return null|mixed|EntityInterface |
||
53 | */ |
||
54 | public function get($entityId, $default = null) |
||
59 | |||
60 | /** |
||
61 | * Remove an entity from identity map |
||
62 | * |
||
63 | * @param mixed $entityId |
||
64 | * |
||
65 | * @return self|$this|IdentityMapInterface |
||
66 | */ |
||
67 | public function remove($entityId) |
||
72 | |||
73 | /** |
||
74 | * Set cache storage for this identity map |
||
75 | * |
||
76 | * @param CacheStorageInterface $cache |
||
77 | * |
||
78 | * @return $this|self|IdentityMap |
||
79 | */ |
||
80 | public function setCache(CacheStorageInterface $cache) |
||
85 | |||
86 | /** |
||
87 | * Gets cache storage for this identity map |
||
88 | * |
||
89 | * @return CacheStorageInterface |
||
90 | */ |
||
91 | public function getCache() |
||
98 | } |