/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/migrations/src/Command/Phinx
NameSizeModeActions
BaseCommand.php2320644editdlrm
CacheBuild.php19050644editdlrm
CacheClear.php19730644editdlrm
CommandTrait.php37490644editdlrm
Create.php48640644editdlrm
Dump.php40590644editdlrm
MarkMigrated.php76200644editdlrm
Migrate.php33230644editdlrm
Rollback.php33820644editdlrm
Seed.php29290644editdlrm
Status.php50040644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/migrations/src/Command/Phinx/Create.php (4864B)
setName('create') ->setDescription('Create a new migration') ->addArgument('name', InputArgument::REQUIRED, 'What is the name of the migration?') ->setHelp(sprintf( '%sCreates a new database migration file%s', PHP_EOL, PHP_EOL )) ->addOption('plugin', 'p', InputOption::VALUE_REQUIRED, 'The plugin the file should be created for') ->addOption('connection', 'c', InputOption::VALUE_REQUIRED, 'The datasource connection to use') ->addOption('source', 's', InputOption::VALUE_REQUIRED, 'The folder where migrations are in') ->addOption('template', 't', InputOption::VALUE_REQUIRED, 'Use an alternative template') ->addOption( 'class', 'l', InputOption::VALUE_REQUIRED, 'Use a class implementing "' . parent::CREATION_INTERFACE . '" to generate the template' ) ->addOption( 'path', null, InputOption::VALUE_REQUIRED, 'Specify the path in which to create this migration' ); } /** * Configures Phinx Create command CLI options that are unused by this extended * command. * * @param \Symfony\Component\Console\Input\InputInterface $input the input object * @param \Symfony\Component\Console\Output\OutputInterface $output the output object * @return void */ protected function beforeExecute(InputInterface $input, OutputInterface $output) { // Set up as a dummy, its value is not going to be used, as a custom // template will always be set. $this->addOption('style', null, InputOption::VALUE_OPTIONAL); $this->parentBeforeExecute($input, $output); } /** * Overrides the action execute method in order to vanish the idea of environments * from phinx. CakePHP does not believe in the idea of having in-app environments * * @param \Symfony\Component\Console\Input\InputInterface $input the input object * @param \Symfony\Component\Console\Output\OutputInterface $output the output object * @return int */ protected function execute(InputInterface $input, OutputInterface $output): int { $result = $this->parentExecute($input, $output); $output->writeln('renaming file in CamelCase to follow CakePHP convention...'); $migrationPaths = $this->getConfig()->getMigrationPaths(); $migrationPath = array_pop($migrationPaths) . DS; /** @var string $name */ $name = $input->getArgument('name'); [$phinxTimestamp, $phinxName] = explode('_', Util::mapClassNameToFileName($name), 2); $migrationFilename = glob($migrationPath . '*' . $phinxName); if (empty($migrationFilename)) { $output->writeln(sprintf('An error occurred while renaming file')); } else { $migrationFilename = $migrationFilename[0]; $path = dirname($migrationFilename) . DS; $name = Inflector::camelize($name); $newPath = $path . Util::getCurrentTimestamp() . '_' . $name . '.php'; $output->writeln('renaming file in CamelCase to follow CakePHP convention...'); if (rename($migrationFilename, $newPath)) { $output->writeln(sprintf('File successfully renamed to %s', $newPath)); } else { $output->writeln(sprintf('An error occurred while renaming file to %s', $newPath)); } } return $result; } }