PHP Class Neos\Kickstarter\Service\GeneratorService

Mostra file Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$generatedFiles array
$inflector Neos\Kickstarter\Utility\Inflector
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
$packageManager Neos\Flow\Package\PackageManagerInterface
$reflectionService Neos\Flow\Reflection\ReflectionService

Public Methods

Method Description
generateActionController ( string $packageKey, string $subpackage, string $controllerName, boolean $overwrite = false ) : array Generate a controller with the given name for the given package
generateCommandController ( string $packageKey, string $controllerName, boolean $overwrite = false ) : array Generate a command controller with the given name for the given package
generateCrudController ( string $packageKey, string $subpackage, string $controllerName, boolean $overwrite = false ) : array Generate an Action Controller with pre-made CRUD methods
generateDocumentation ( string $packageKey ) : array Generate a documentation skeleton for the package key
generateLayout ( string $packageKey, string $layoutName, boolean $overwrite = false ) : array Generate a default layout
generateModel ( string $packageKey, string $modelName, array $fieldDefinitions, boolean $overwrite = false ) : array Generate a model for the package with the given model name and fields
generateRepository ( string $packageKey, string $modelName, boolean $overwrite = false ) : array Generate a repository for a model given a model name and package key
generateTestsForModel ( string $packageKey, string $modelName, boolean $overwrite = false ) : array Generate a dummy testcase for a model for the package with the given model name
generateView ( string $packageKey, string $subpackage, string $controllerName, string $viewName, string $templateName, boolean $overwrite = false ) : array Generate a view with the given name for the given package and controller

Protected Methods

Method Description
generateFile ( string $targetPathAndFilename, string $fileContent, boolean $force = false ) : void Generate a file with the given content and add it to the generated files
getPrimaryNamespaceAndEntryPath ( Neos\Flow\Package\PackageInterface $package ) : array
normalizeFieldDefinitions ( array $fieldDefinitions, string $namespace = '' ) : array Normalize types and prefix types with namespaces
renderTemplate ( string $templatePathAndFilename, array $contextVariables ) : string Render the given template file with the given variables

Method Details

generateActionController() public method

Generate a controller with the given name for the given package
public generateActionController ( string $packageKey, string $subpackage, string $controllerName, boolean $overwrite = false ) : array
$packageKey string The package key of the controller's package
$subpackage string An optional subpackage name
$controllerName string The name of the new controller
$overwrite boolean Overwrite any existing files?
return array An array of generated filenames

generateCommandController() public method

Generate a command controller with the given name for the given package
public generateCommandController ( string $packageKey, string $controllerName, boolean $overwrite = false ) : array
$packageKey string The package key of the controller's package
$controllerName string The name of the new controller
$overwrite boolean Overwrite any existing files?
return array An array of generated filenames

generateCrudController() public method

Generate an Action Controller with pre-made CRUD methods
public generateCrudController ( string $packageKey, string $subpackage, string $controllerName, boolean $overwrite = false ) : array
$packageKey string The package key of the controller's package
$subpackage string An optional subpackage name
$controllerName string The name of the new controller
$overwrite boolean Overwrite any existing files?
return array An array of generated filenames

generateDocumentation() public method

Generate a documentation skeleton for the package key
public generateDocumentation ( string $packageKey ) : array
$packageKey string The package key
return array An array of generated filenames

generateFile() protected method

Generate a file with the given content and add it to the generated files
protected generateFile ( string $targetPathAndFilename, string $fileContent, boolean $force = false ) : void
$targetPathAndFilename string
$fileContent string
$force boolean
return void

generateLayout() public method

Generate a default layout
public generateLayout ( string $packageKey, string $layoutName, boolean $overwrite = false ) : array
$packageKey string The package key of the controller's package
$layoutName string The name of the layout
$overwrite boolean Overwrite any existing files?
return array An array of generated filenames

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

generateRepository() public method

Generate a repository for a model given a model name and package key
public generateRepository ( string $packageKey, string $modelName, boolean $overwrite = false ) : array
$packageKey string The package key
$modelName string The name of the model
$overwrite boolean Overwrite any existing files?
return array An array of generated filenames

generateTestsForModel() public method

Generate a dummy testcase for a model for the package with the given model name
public generateTestsForModel ( string $packageKey, string $modelName, boolean $overwrite = false ) : array
$packageKey string The package key of the controller's package
$modelName string The name of the new model fpr which to generate the test
$overwrite boolean Overwrite any existing files?
return array An array of generated filenames

generateView() public method

Generate a view with the given name for the given package and controller
public generateView ( string $packageKey, string $subpackage, string $controllerName, string $viewName, string $templateName, boolean $overwrite = false ) : array
$packageKey string The package key of the controller's package
$subpackage string An optional subpackage name
$controllerName string The name of the new controller
$viewName string The name of the view
$templateName string The name of the view
$overwrite boolean Overwrite any existing files?
return array An array of generated filenames

getPrimaryNamespaceAndEntryPath() protected method

protected getPrimaryNamespaceAndEntryPath ( Neos\Flow\Package\PackageInterface $package ) : array
$package Neos\Flow\Package\PackageInterface
return array

normalizeFieldDefinitions() protected method

Normalize types and prefix types with namespaces
protected normalizeFieldDefinitions ( array $fieldDefinitions, string $namespace = '' ) : array
$fieldDefinitions array The field definitions
$namespace string The namespace
return array The normalized and type converted field definitions

renderTemplate() protected method

Render the given template file with the given variables
protected renderTemplate ( string $templatePathAndFilename, array $contextVariables ) : string
$templatePathAndFilename string
$contextVariables array
return string

Property Details

$generatedFiles protected_oe property

protected array $generatedFiles
return array

$inflector protected_oe property

protected Inflector,Neos\Kickstarter\Utility $inflector
return Neos\Kickstarter\Utility\Inflector

$objectManager protected_oe property

protected ObjectManagerInterface,Neos\Flow\ObjectManagement $objectManager
return Neos\Flow\ObjectManagement\ObjectManagerInterface

$packageManager protected_oe property

protected PackageManagerInterface,Neos\Flow\Package $packageManager
return Neos\Flow\Package\PackageManagerInterface

$reflectionService protected_oe property

protected ReflectionService,Neos\Flow\Reflection $reflectionService
return Neos\Flow\Reflection\ReflectionService