Baleen\Migrations\Delta\Delta\Delta\Collection\Linked¶
-
class
Linked
¶ Represents a set of Versions, all of which must be linked to a Migration.
-
property
resolver
¶ protected ResolverInterface
-
validate
(DeltaInterface $element)¶ Validates that migrations added to this set must all have a linked Migration.
Parameters: - $element (DeltaInterface) –
Returns: bool
-
__construct
($versions =, []ResolverInterface $resolver = null, ComparatorInterface $comparator = null)¶ Parameters: - $versions (DeltaInterface[]) –
- $resolver (ResolverInterface) –
- $comparator (ComparatorInterface) –
-
sort
(ComparatorInterface $comparator = null)¶ Sort the collection
Parameters: - $comparator (ComparatorInterface) –
Returns: static
-
getReverse
()¶ Returns a collection with elements sorted in reverse order.
Returns: static
-
merge
(CollectionInterface $collection)¶ Merges another set into this one, replacing versions that exist and adding those that don’t.
Parameters: - $collection (CollectionInterface) –
Returns: $this
-
getByPosition
($position)¶ Returns the element at the given position.
Parameters: - $position –
Returns: null|DeltaInterface
-
add
($element)¶ Parameters: - $element –
-
isSorted
()¶ Returns whether the collection is sorted or not
Returns: bool
-
setResolver
(ResolverInterface $resolver)¶ Parameters: - $resolver (ResolverInterface) –
-
getResolver
()¶ Returns: ResolverInterface
-
get
($key, $resolve = true)¶ Gets an element.
Parameters: - $key (mixed) – If an alias is given then it will be resolved to an element. Otherwise the $key will be used to fetch the element by index.
- $resolve (bool) – Whether to use the resolver or not.
Returns: DeltaInterface|null Null if not present
-
getById
($id)¶ Gets a version by id
Parameters: - $id –
Returns: DeltaInterface
-
indexOfId
($id)¶ Returns the index of the version that has the given id. Returns null if not found.
Parameters: - $id (string) –
Returns: int|null
-
resolve
($alias)¶ Resolves an alias in to a version
Parameters: - $alias (string) –
Returns: DeltaInterface|null
-
has
($index, $resolve = true)¶ Returns whether the key exists in the collection.
Parameters: - $index –
- $resolve (bool) –
Returns: bool
-
invalidateResolverCache
()¶ invalidateResolverCache
-
remove
($version)¶ Parameters: - $version –
Returns: DeltaInterface|null
-
addOrReplace
(DeltaInterface $version)¶ Adds a new version to the collection if it doesn’t exist or replaces it if it does.
Parameters: - $version (DeltaInterface) –
-
property