Exemple #1
0
 /**
  * Returns true if the specified version is valid (can be added) to the collection. Otherwise, it MUST throw
  * an exception.
  *
  * @param VersionInterface $version
  * @return bool
  *
  * @throws CollectionException
  * @throws \Baleen\Migrations\Exception\Version\Collection\AlreadyExistsException
  */
 public function validate(VersionInterface $version)
 {
     if (!$version instanceof LinkedVersion) {
         throw new CollectionException(sprintf('Invalid class type "%s". This collection only accepts versions instance of "%s".', get_class($version), LinkedVersion::class));
     }
     return parent::validate($version);
 }
Exemple #2
0
 /**
  * Returns true if the specified version is valid (can be added) to the collection. Otherwise, it MUST throw
  * an exception.
  *
  * @param VersionInterface $version
  *
  * @return bool
  *
  * @throws CollectionException
  * @throws \Baleen\Migrations\Exception\Version\Collection\AlreadyExistsException
  */
 public function validate(VersionInterface $version)
 {
     if (!$version->isMigrated()) {
         throw new CollectionException('Invalid version specified. This collection only accepts versions that are migrated.');
     }
     return parent::validate($version);
 }