Ejemplo n.º 1
0
 public function _writeMigrations($migrationChanges, InputInterface $input, OutputInterface $output)
 {
     $output->writeln('Creating Migrations :');
     /** @var $migration Migration */
     /* @var $op Operation */
     foreach ($migrationChanges as $migration) {
         $migrationFile = MigrationFile::createObject($migration);
         $fileName = $migrationFile->getFileName();
         $output->writeln('  ' . $fileName);
         $operations = $migration->getOperations();
         foreach ($operations as $op) {
             $output->writeln(sprintf('     - %s', ucwords($op->getDescription())));
         }
         // write content to file.
         $handler = new FileHandler(BaseOrm::getMigrationsPath(), $fileName);
         $handler->write($migrationFile->getContent());
     }
 }
Ejemplo n.º 2
0
 /**
  * Returns a list of all model files.
  *
  * @return array
  */
 public function getModelFiles()
 {
     $fileHandler = new FileHandler(BaseOrm::getModelsPath());
     return $fileHandler->readDir('php');
 }
Ejemplo n.º 3
0
 /**
  * @param $name
  *
  * @return BaseCommand
  *
  * @since 1.1.0
  *
  * @author Eddilbert Macharia (http://eddmash.com) <*****@*****.**>
  */
 public function fetchCommand($name)
 {
     $name = ucfirst($name);
     $file = null;
     $packageName = null;
     foreach ($this->path as $package => $path) {
         $file_handler = new FileHandler($path);
         $file = $file_handler->getFile($name);
         if ($file !== false) {
             $packageName = $package;
             break;
         }
     }
     if (false === $file) {
         $this->error(sprintf('Unknown command: ` %1$s`. Does the file exists `%2$s/%1$s.php` ?' . PHP_EOL, $name, $this->path));
         $message = $this->ansiFormat(sprintf('php %s.php help', $this->managerName), Console::FG_YELLOW);
         $this->normal(sprintf('Type %s for usage.' . PHP_EOL, $message));
         return false;
     }
     // commands are in the commands namespace
     /** @var $className BaseCommand */
     $className = ClassHelper::getFormatNamespace($packageName) . 'Console\\Command\\' . $name;
     return new $className();
 }
Ejemplo n.º 4
0
 public function getMigrationsFiles()
 {
     $fileHandler = FileHandler::createObject(['path' => BaseOrm::getMigrationsPath()]);
     return $fileHandler->getPathFiles();
 }