/** * Do this execute. * * @return mixed */ protected function doExecute() { $this->io->out('[<comment>SQL</comment>] Running migrations'); $package = 'gen_' . $this->config['replace.package.name.lower']; if (!PackageHelper::getPackage($package)) { $packageClass = sprintf('%s%s\\%sPackage', $this->config['replace.package.namespace'], $this->config['replace.package.name.cap'], $this->config['replace.package.name.cap']); PackageHelper::getInstance()->addPackage($package, $packageClass); } $dir = WINDWALKER_SOURCE . '/' . str_replace('\\', '/', MvcHelper::getPackageNamespace($packageClass, 1)) . '/Migration'; /** @var WindwalkerConsole $app */ $app = Ioc::getApplication(); // A dirty work to call migration command. /** @var IOInterface $io */ $io = clone $this->io->getIO(); $io->setArguments(array('migration', 'migrate')); $io->setOption('d', $dir); $io->setOption('seed', null); $io->setOption('s', null); $io->setOption('no-backup', true); $app->getRootCommand()->setIO($io)->execute(); }
/** * getFieldDefinition * * @param string $definition * @param string $name * * @return FieldDefinitionInterface */ public function getFieldDefinition($definition = null, $name = null) { if (class_exists($definition) && is_subclass_of($definition, FieldDefinitionInterface::class)) { return new $definition(); } $name = $name ?: $this->getName(); if (!($class = FieldDefinitionResolver::create(ucfirst($name) . '\\' . ucfirst($definition)))) { $class = sprintf('%s\\Form\\%s\\%sDefinition', MvcHelper::getPackageNamespace($this, 2), ucfirst($name), ucfirst($definition)); if (!class_exists($class)) { return new NullFiledDefinition(); } } return new $class(); }