1 | <?php |
||
26 | abstract class AbstractEditableRepository extends AbstractRepository implements EditableRepository |
||
27 | { |
||
28 | /** |
||
29 | * @var ChangeStream |
||
30 | */ |
||
31 | private $changeStream; |
||
32 | |||
33 | /** |
||
34 | * Create the repository. |
||
35 | * |
||
36 | * @param ChangeStream|null $changeStream If provided, the repository will log |
||
37 | * resources changes in this change stream. |
||
38 | */ |
||
39 | 656 | public function __construct(ChangeStream $changeStream = null) |
|
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 48 | public function getStack($path) |
|
48 | { |
||
49 | 48 | if (!$this->changeStream) { |
|
50 | 6 | return parent::getStack($path); |
|
51 | } |
||
52 | |||
53 | 42 | return $this->changeStream->buildStack($this, $path); |
|
54 | } |
||
55 | |||
56 | /** |
||
57 | * Append a change to the ChangeStream if possible. |
||
58 | * |
||
59 | * @param PuliResource $resource |
||
60 | */ |
||
61 | 467 | protected function appendToChangeStream(PuliResource $resource) |
|
67 | } |
||
68 |