Ejemplo n.º 1
0
 /**
  * Migrate constructor
  *
  * @param string $dirname module directory name that defines the tables to be migrated
  *
  * @throws \InvalidArgumentException
  * @throws \RuntimeException
  */
 public function __construct($dirname)
 {
     $this->helper = Helper::getHelper($dirname);
     if (false === $this->helper) {
         throw new \InvalidArgumentException("Invalid module {$dirname} specified");
     }
     $module = $this->helper->getModule();
     $this->moduleTables = $module->getInfo('tables');
     if (empty($this->moduleTables)) {
         throw new \RuntimeException("No tables established in module");
     }
     $version = $module->getInfo('version');
     $this->tableDefinitionFile = $this->helper->path("sql/{$dirname}_{$version}_migrate.yml");
     $this->tableHandler = new Tables();
 }