generateModel() public method

Generate a model for the package with the given model name and fields
public generateModel ( string $packageKey, string $modelName, array $fieldDefinitions, boolean $overwrite = false ) : array
$packageKey string The package key of the controller's package
$modelName string The name of the new model
$fieldDefinitions array The field definitions
$overwrite boolean Overwrite any existing files?
return array An array of generated filenames
 /**
  * Kickstart a new domain model
  *
  * This command generates a new domain model class. The fields are specified as
  * a variable list of arguments with field name and type separated by a colon
  * (for example "title:string" "size:int" "type:MyType").
  *
  * @param string $packageKey The package key of the package for the domain model
  * @param string $modelName The name of the new domain model class
  * @param boolean $force Overwrite any existing model.
  * @return string
  * @see neos.kickstarter:kickstart:repository
  */
 public function modelCommand($packageKey, $modelName, $force = false)
 {
     $this->validatePackageKey($packageKey);
     if (!$this->packageManager->isPackageAvailable($packageKey)) {
         $this->outputLine('Package "%s" is not available.', array($packageKey));
         exit(2);
     }
     $this->validateModelName($modelName);
     $fieldsArguments = $this->request->getExceedingArguments();
     $fieldDefinitions = array();
     foreach ($fieldsArguments as $fieldArgument) {
         list($fieldName, $fieldType) = explode(':', $fieldArgument, 2);
         $fieldDefinitions[$fieldName] = array('type' => $fieldType);
         if (strpos($fieldType, 'array') !== false) {
             $fieldDefinitions[$fieldName]['typeHint'] = 'array';
         } elseif (strpos($fieldType, '\\') !== false) {
             if (strpos($fieldType, '<') !== false) {
                 $fieldDefinitions[$fieldName]['typeHint'] = substr($fieldType, 0, strpos($fieldType, '<'));
             } else {
                 $fieldDefinitions[$fieldName]['typeHint'] = $fieldType;
             }
         }
     }
     $generatedFiles = $this->generatorService->generateModel($packageKey, $modelName, $fieldDefinitions, $force);
     $this->outputLine(implode(PHP_EOL, $generatedFiles));
     $this->outputLine('As a new model was generated, don\'t forget to update the database schema with the respective doctrine:* commands.');
 }