Example #1
0
 /**
  * @param  array  $models
  * @param  string $message
  * @return bool
  */
 private function writeModelFiles(array $models, $message)
 {
     $targetDirectory = $this->getParam('target-dir');
     $numberOfMissingModels = count($models);
     if ($numberOfMissingModels > 0) {
         $this->modelGenerator->writeMissingModelFiles($this->schema, $targetDirectory);
         $this->outputWriter->writeLine($message . $numberOfMissingModels, OutputWriterInterface::LEVEL_LESS_INFO);
         return true;
     }
     return false;
 }
Example #2
0
 /**
  * user interaction read from STDIN
  *
  * @param  string $message
  * @param  string $type
  * @return string
  */
 public function readInput($message, $type = 'string')
 {
     do {
         $this->outputWriter->write($message . ': ');
         $input = trim(fgets(STDIN));
     } while ($input === '');
     switch ($type) {
         case 'boolean':
             return $this->isInputValueTrue($input);
     }
     return $input;
 }
Example #3
0
 /**
  * @param $definition
  * @param $outputSchemaFile
  */
 private function writeSchemaFile($definition, $outputSchemaFile)
 {
     $schemaWriter = new SchemaWriter(new Schema($definition));
     $schemaWriter->write($outputSchemaFile);
     $this->outputWriter->writeLine("Dive schema file has been written to: {$outputSchemaFile}");
 }