コード例 #1
0
 /**
  * Loads a list of thumanils for the specicifies parameters, returns an array of Schedule\Task elements
  *
  * @return array
  */
 public function load()
 {
     $versions = [];
     $data = $this->db->fetchCol("SELECT id FROM " . Migration\Resource::TABLE_NAME . ' ' . $this->getCondition() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
     foreach ($data as $id) {
         $migration = new Migration();
         $migration->setId($id);
         $versions[] = $migration;
     }
     $this->model->setMigrations($versions);
     return $versions;
 }
コード例 #2
0
 /**
  * Adds a version into storage
  *
  * @param Version $version
  *
  * @return Migration
  * @throws StorageException
  */
 public function save(Version $version)
 {
     if ($this->findMigrationByVersion($version)) {
         throw new StorageException(sprintf('Version with id "%s" already exists.', $version->getId()));
     }
     $migration = new Migration();
     $migration->setId($version->getId());
     $migration->save();
     return $migration;
 }