public function generateView($packageKey, $subpackage, $controllerName, $viewName, $templateName, $overwrite = false)
    {
        list($baseNamespace) = $this->getPrimaryNamespaceAndEntryPath($this->packageManager->getPackage($packageKey));
        $viewName = ucfirst($viewName);

        $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/View/' . $templateName . 'Template.html';

        $contextVariables = [];
        $contextVariables['packageKey'] = $packageKey;
        $contextVariables['subpackage'] = $subpackage;
        $contextVariables['isInSubpackage'] = ($subpackage != '');
        $contextVariables['controllerName'] = $controllerName;
        $contextVariables['viewName'] = $viewName;
        $contextVariables['modelName'] = strtolower($controllerName[0]) . substr($controllerName, 1);
        $contextVariables['repositoryClassName'] = '\\' . trim($baseNamespace, '\\') . ($subpackage != '' ? '\\' . $subpackage : '') . '\Domain\Repository\\' . $controllerName . 'Repository';
        $contextVariables['modelFullClassName'] = '\\' . trim($baseNamespace, '\\') . ($subpackage != '' ? '\\' . $subpackage : '') . '\Domain\Model\\' . $controllerName;
        $contextVariables['modelClassName'] = ucfirst($contextVariables['modelName']);

        $modelClassSchema = $this->reflectionService->getClassSchema($contextVariables['modelFullClassName']);
        if ($modelClassSchema !== null) {
            $contextVariables['properties'] = $modelClassSchema->getProperties();
            if (isset($contextVariables['properties']['Persistence_Object_Identifier'])) {
                unset($contextVariables['properties']['Persistence_Object_Identifier']);
            }
        }

        if (!isset($contextVariables['properties']) || $contextVariables['properties'] === []) {
            $contextVariables['properties'] = ['name' => ['type' => 'string']];
        }

        $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);

        $subpackagePath = $subpackage != '' ? $subpackage . '/' : '';
        $viewFilename = $viewName . '.html';
        $viewPath = 'resource://' . $packageKey . '/Private/Templates/' . $subpackagePath . $controllerName . '/';
        $targetPathAndFilename = $viewPath . $viewFilename;

        $this->generateFile($targetPathAndFilename, $fileContent, $overwrite);

        return $this->generatedFiles;
    }
public function generateView($packageKey, $subpackage, $controllerName, $viewName, $templateName, $overwrite = false)
    {
        list($baseNamespace) = $this->getPrimaryNamespaceAndEntryPath($this->packageManager->getPackage($packageKey));
        $viewName = ucfirst($viewName);

        $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/View/' . $templateName . 'Template.html';

        $contextVariables = [];
        $contextVariables['packageKey'] = $packageKey;
        $contextVariables['subpackage'] = $subpackage;
        $contextVariables['isInSubpackage'] = ($subpackage != '');
        $contextVariables['controllerName'] = $controllerName;
        $contextVariables['viewName'] = $viewName;
        $contextVariables['modelName'] = strtolower($controllerName[0]) . substr($controllerName, 1);
        $contextVariables['repositoryClassName'] = '\\' . trim($baseNamespace, '\\') . ($subpackage != '' ? '\\' . $subpackage : '') . '\Domain\Repository\\' . $controllerName . 'Repository';
        $contextVariables['modelFullClassName'] = '\\' . trim($baseNamespace, '\\') . ($subpackage != '' ? '\\' . $subpackage : '') . '\Domain\Model\\' . $controllerName;
        $contextVariables['modelClassName'] = ucfirst($contextVariables['modelName']);

        $modelClassSchema = $this->reflectionService->getClassSchema($contextVariables['modelFullClassName']);
        if ($modelClassSchema !== null) {
            $contextVariables['properties'] = $modelClassSchema->getProperties();
            if (isset($contextVariables['properties']['Persistence_Object_Identifier'])) {
                unset($contextVariables['properties']['Persistence_Object_Identifier']);
            }
        }

        if (!isset($contextVariables['properties']) || $contextVariables['properties'] === []) {
            $contextVariables['properties'] = ['name' => ['type' => 'string']];
        }

        $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);

        $subpackagePath = $subpackage != '' ? $subpackage . '/' : '';
        $viewFilename = $viewName . '.html';
        $viewPath = 'resource://' . $packageKey . '/Private/Templates/' . $subpackagePath . $controllerName . '/';
        $targetPathAndFilename = $viewPath . $viewFilename;

        $this->generateFile($targetPathAndFilename, $fileContent, $overwrite);

        return $this->generatedFiles;
    }
public function generateView ( $ packageKey , $ subpackage , $ controllerName , $ viewName , $ templateName , $ overwrite = false ) { list ( $ baseNamespace ) = $ this -> getPrimaryNamespaceAndEntryPath ( $ this -> packageManager -> getPackage ( $ packageKey ) ) ; $ viewName = ucfirst ( $ viewName ) ; $ templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/View/' . $ templateName . 'Template.html' ; $ contextVariables = [ ] ; $ contextVariables [ 'packageKey' ] = $ packageKey ; $ contextVariables [ 'subpackage' ] = $ subpackage ; $ contextVariables [ 'isInSubpackage' ] = ( $ subpackage != '' ) ; $ contextVariables [ 'controllerName' ] = $ controllerName ; $ contextVariables [ 'viewName' ] = $ viewName ; $ contextVariables [ 'modelName' ] = strtolower ( $ controllerName [ 0 ] ) . substr ( $ controllerName , 1 ) ; $ contextVariables [ 'repositoryClassName' ] = '\\' . trim ( $ baseNamespace , '\\' ) . ( $ subpackage != '' ? '\\' . $ subpackage : '' ) . '\Domain\Repository\\' . $ controllerName . 'Repository' ; $ contextVariables [ 'modelFullClassName' ] = '\\' . trim ( $ baseNamespace , '\\' ) . ( $ subpackage != '' ? '\\' . $ subpackage : '' ) . '\Domain\Model\\' . $ controllerName ; $ contextVariables [ 'modelClassName' ] = ucfirst ( $ contextVariables [ 'modelName' ] ) ; $ modelClassSchema = $ this -> reflectionService -> getClassSchema ( $ contextVariables [ 'modelFullClassName' ] ) ; if ( $ modelClassSchema !== null ) { $ contextVariables [ 'properties' ] = $ modelClassSchema -> getProperties ( ) ; if ( isset ( $ contextVariables [ 'properties' ] [ 'Persistence_Object_Identifier' ] ) ) { unset ( $ contextVariables [ 'properties' ] [ 'Persistence_Object_Identifier' ] ) ; } } if ( ! isset ( $ contextVariables [ 'properties' ] ) || $ contextVariables [ 'properties' ] === [ ] ) { $ contextVariables [ 'properties' ] = [ 'name' => [ 'type' => 'string' ] ] ; } $ fileContent = $ this -> renderTemplate ( $ templatePathAndFilename , $ contextVariables ) ; $ subpackagePath = $ subpackage != '' ? $ subpackage . '/' : '' ; $ viewFilename = $ viewName . '.html' ; $ viewPath = 'resource://' . $ packageKey . '/Private/Templates/' . $ subpackagePath . $ controllerName . '/' ; $ targetPathAndFilename = $ viewPath . $ viewFilename ; $ this -> generateFile ( $ targetPathAndFilename , $ fileContent , $ overwrite ) ; return $ this -> generatedFiles ; }
Generate a view with the given name for the given package and controller

@param string $packageKey The package key of the controller's package
@param string $subpackage An optional subpackage name
@param string $controllerName The name of the new controller
@param string $viewName The name of the view
@param string $templateName The name of the view
@param boolean $overwrite Overwrite any existing files?
@return array An array of generated filenames
Generate a view with the given name for the given package and controller