src/Graviton/GeneratorBundle/Generator/ResourceGenerator.php
protected function generateServices($parameters, $dir, $document)
    {
        $bundleParts = explode('\\', $parameters['base']);
        $shortName = $bundleParts[0];
        $shortBundle = $this->getBundleBaseName($bundleParts[1]);

        $docName = implode(
            '.',
            array(
                strtolower($shortName),
                strtolower($shortBundle),
                'document',
                strtolower($parameters['document'])
            )
        );

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

        $this->addService(
            $docName,
            null,
            [],
            null,
            [],
            null,
            null,
            '%'. $docName . '.class%'
        );

        $this->addParameter(
            (array) $parameters['json']->getRoles(),
            $docName . '.roles'
        );

        $repoName = implode(
            '.',
            array(
                strtolower($shortName),
                strtolower($shortBundle),
                'repository',
                strtolower($parameters['document'])
            )
        );

        $this->addService(
            $repoName,
            null,
            [],
            null,
            array(
                array(
                    'type' => 'string',
                    'value' => $parameters['bundle'] . ':' . $document
                )
            ),
            'doctrine_mongodb.odm.default_document_manager',
            'getRepository',
            'Doctrine\ODM\MongoDB\DocumentRepository'
        );

        $this->addService(
            $repoName . 'embedded',
            null,
            [],
            null,
            array(
                array(
                    'type' => 'string',
                    'value' => $parameters['bundle'] . ':' . $document . 'Embedded'
                )
            ),
            'doctrine_mongodb.odm.default_document_manager',
            'getRepository',
            'Doctrine\ODM\MongoDB\DocumentRepository'
        );
    }
protected function generateServices($parameters, $dir, $document)
    {
        $bundleParts = explode('\\', $parameters['base']);
        $shortName = $bundleParts[0];
        $shortBundle = $this->getBundleBaseName($bundleParts[1]);

        $docName = implode(
            '.',
            array(
                strtolower($shortName),
                strtolower($shortBundle),
                'document',
                strtolower($parameters['document'])
            )
        );

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

        $this->addService(
            $docName,
            null,
            [],
            null,
            [],
            null,
            null,
            '%'. $docName . '.class%'
        );

        $this->addParameter(
            (array) $parameters['json']->getRoles(),
            $docName . '.roles'
        );

        $repoName = implode(
            '.',
            array(
                strtolower($shortName),
                strtolower($shortBundle),
                'repository',
                strtolower($parameters['document'])
            )
        );

        $this->addService(
            $repoName,
            null,
            [],
            null,
            array(
                array(
                    'type' => 'string',
                    'value' => $parameters['bundle'] . ':' . $document
                )
            ),
            'doctrine_mongodb.odm.default_document_manager',
            'getRepository',
            'Doctrine\ODM\MongoDB\DocumentRepository'
        );

        $this->addService(
            $repoName . 'embedded',
            null,
            [],
            null,
            array(
                array(
                    'type' => 'string',
                    'value' => $parameters['bundle'] . ':' . $document . 'Embedded'
                )
            ),
            'doctrine_mongodb.odm.default_document_manager',
            'getRepository',
            'Doctrine\ODM\MongoDB\DocumentRepository'
        );
    }
protected function generateServices ( $ parameters , $ dir , $ document ) { $ bundleParts = explode ( '\\' , $ parameters [ 'base' ] ) ; $ shortName = $ bundleParts [ 0 ] ; $ shortBundle = $ this -> getBundleBaseName ( $ bundleParts [ 1 ] ) ; $ docName = implode ( '.' , array ( strtolower ( $ shortName ) , strtolower ( $ shortBundle ) , 'document' , strtolower ( $ parameters [ 'document' ] ) ) ) ; $ this -> addParameter ( $ parameters [ 'base' ] . 'Document\\' . $ parameters [ 'document' ] , $ docName . '.class' ) ; $ this -> addService ( $ docName , null , [ ] , null , [ ] , null , null , '%' . $ docName . '.class%' ) ; $ this -> addParameter ( ( array ) $ parameters [ 'json' ] -> getRoles ( ) , $ docName . '.roles' ) ; $ repoName = implode ( '.' , array ( strtolower ( $ shortName ) , strtolower ( $ shortBundle ) , 'repository' , strtolower ( $ parameters [ 'document' ] ) ) ) ; $ this -> addService ( $ repoName , null , [ ] , null , array ( array ( 'type' => 'string' , 'value' => $ parameters [ 'bundle' ] . ':' . $ document ) ) , 'doctrine_mongodb.odm.default_document_manager' , 'getRepository' , 'Doctrine\ODM\MongoDB\DocumentRepository' ) ; $ this -> addService ( $ repoName . 'embedded' , null , [ ] , null , array ( array ( 'type' => 'string' , 'value' => $ parameters [ 'bundle' ] . ':' . $ document . 'Embedded' ) ) , 'doctrine_mongodb.odm.default_document_manager' , 'getRepository' , 'Doctrine\ODM\MongoDB\DocumentRepository' ) ; }
update xml services

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

@return void
update xml services