1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
4
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
5
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
6
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
7
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
8
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
9
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
10
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
11
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
12
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
13
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
14
|
|
|
* |
15
|
|
|
* This software consists of voluntary contributions made by many individuals |
16
|
|
|
* and is licensed under the MIT license. For more information, see |
17
|
|
|
* <https://github.com/baleen/migrations>. |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace Baleen\Migrations\Delta\Repository; |
21
|
|
|
|
22
|
|
|
use Baleen\Migrations\Common\Collection\CollectionInterface; |
23
|
|
|
use Baleen\Migrations\Delta\DeltaId; |
24
|
|
|
use Baleen\Migrations\Delta\DeltaInterface; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Provides a collection of Versions that have been migrated. |
28
|
|
|
* |
29
|
|
|
* @author Gabriel Somoza <[email protected]> |
30
|
|
|
*/ |
31
|
|
|
interface VersionRepositoryInterface |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* Fetch versions from the storage mapper. |
35
|
|
|
* |
36
|
|
|
* @return DeltaId[] |
37
|
|
|
*/ |
38
|
|
|
public function fetchAll(); |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Fetch a single version from the storage mapper. |
42
|
|
|
* |
43
|
|
|
* @param string|DeltaId $id |
44
|
|
|
* |
45
|
|
|
* @return DeltaId |
46
|
|
|
*/ |
47
|
|
|
public function fetch($id); |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Updates the storage by adding all versions from the collection that are migrated, and remove all versions which |
51
|
|
|
* are NOT migrated. |
52
|
|
|
* |
53
|
|
|
* @param CollectionInterface $versions |
54
|
|
|
* |
55
|
|
|
* @return bool Returns false on failure. |
56
|
|
|
*/ |
57
|
|
|
public function updateAll(CollectionInterface $versions); |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Saves or deletes a version depending on whether the version is respectively migrated or not. |
61
|
|
|
* |
62
|
|
|
* @param DeltaInterface $version |
63
|
|
|
* @return bool The result of calling 'save' or 'delete' on the version. |
64
|
|
|
*/ |
65
|
|
|
public function update(DeltaInterface $version); |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Adds a version into storage |
69
|
|
|
* |
70
|
|
|
* @param DeltaInterface $version |
71
|
|
|
* |
72
|
|
|
* @return bool |
73
|
|
|
*/ |
74
|
|
|
public function save(DeltaInterface $version); |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Removes a version from storage |
78
|
|
|
* |
79
|
|
|
* @param DeltaInterface $version |
80
|
|
|
* |
81
|
|
|
* @return bool |
82
|
|
|
*/ |
83
|
|
|
public function delete(DeltaInterface $version); |
84
|
|
|
} |
85
|
|
|
|