src/Graviton/GeneratorBundle/Generator/ResourceGenerator.php
protected function generateController(array $parameters, $dir, $document)
    {
        $this->renderFile(
            'controller/DocumentController.php.twig',
            $dir . '/Controller/' . $document . 'Controller.php',
            $parameters
        );

        $bundleParts = explode('\\', $parameters['base']);
        $shortName = strtolower($bundleParts[0]);
        $shortBundle = strtolower(substr($bundleParts[1], 0, -6));
        $paramName = implode('.', array($shortName, $shortBundle, 'controller', strtolower($parameters['document'])));

        $this->addParameter(
            $parameters['base'] . 'Controller\\' . $parameters['document'] . 'Controller',
            $paramName . '.class'
        );

        $this->addService(
            $paramName,
            $parameters['parent'],
            array(
                array(
                    'method' => 'setModel',
                    'service' => implode(
                        '.',
                        array($shortName, $shortBundle, 'model', strtolower($parameters['document']))
                    )
                )
            ),
            'graviton.rest'
        );
    }
protected function generateController(array $parameters, $dir, $document)
    {
        $this->renderFile(
            'controller/DocumentController.php.twig',
            $dir . '/Controller/' . $document . 'Controller.php',
            $parameters
        );

        $bundleParts = explode('\\', $parameters['base']);
        $shortName = strtolower($bundleParts[0]);
        $shortBundle = strtolower(substr($bundleParts[1], 0, -6));
        $paramName = implode('.', array($shortName, $shortBundle, 'controller', strtolower($parameters['document'])));

        $this->addParameter(
            $parameters['base'] . 'Controller\\' . $parameters['document'] . 'Controller',
            $paramName . '.class'
        );

        $this->addService(
            $paramName,
            $parameters['parent'],
            array(
                array(
                    'method' => 'setModel',
                    'service' => implode(
                        '.',
                        array($shortName, $shortBundle, 'model', strtolower($parameters['document']))
                    )
                )
            ),
            'graviton.rest'
        );
    }
protected function generateController ( array $ parameters , $ dir , $ document ) { $ this -> renderFile ( 'controller/DocumentController.php.twig' , $ dir . '/Controller/' . $ document . 'Controller.php' , $ parameters ) ; $ bundleParts = explode ( '\\' , $ parameters [ 'base' ] ) ; $ shortName = strtolower ( $ bundleParts [ 0 ] ) ; $ shortBundle = strtolower ( substr ( $ bundleParts [ 1 ] , 0 , - 6 ) ) ; $ paramName = implode ( '.' , array ( $ shortName , $ shortBundle , 'controller' , strtolower ( $ parameters [ 'document' ] ) ) ) ; $ this -> addParameter ( $ parameters [ 'base' ] . 'Controller\\' . $ parameters [ 'document' ] . 'Controller' , $ paramName . '.class' ) ; $ this -> addService ( $ paramName , $ parameters [ 'parent' ] , array ( array ( 'method' => 'setModel' , 'service' => implode ( '.' , array ( $ shortName , $ shortBundle , 'model' , strtolower ( $ parameters [ 'document' ] ) ) ) ) ) , 'graviton.rest' ) ; }
generate RESTful controllers ans service configs

@param array  $parameters twig parameters
@param string $dir        base bundle dir
@param string $document   document name

@return void
generate RESTful controllers ans service configs