src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php
protected function generateResources(
        JsonDefinition $jsonDef,
        $bundleName,
        $bundleDir,
        $bundleNamespace
    ) {

        /** @var ResourceGenerator $generator */
        $generator = $this->resourceGenerator;
        $generator->setGenerateController(false);

        foreach ($this->getSubResources($jsonDef) as $subRecource) {
            $generator->setJson(new JsonDefinition($subRecource->getDef()->setIsSubDocument(true)));
            $generator->generate(
                $bundleDir,
                $bundleNamespace,
                $bundleName,
                $subRecource->getId()
            );
        }

        // main resources
        if (!empty($jsonDef->getFields())) {
            $generator->setGenerateController(true);

            $routerBase = $jsonDef->getRouterBase();
            if ($routerBase === false || $this->isNotWhitelistedController($routerBase)) {
                $generator->setGenerateController(false);
            }

            $generator->setJson(new JsonDefinition($jsonDef->getDef()));
            $generator->generate(
                $bundleDir,
                $bundleNamespace,
                $bundleName,
                $jsonDef->getId()
            );
        }
    }
protected function generateResources(
        JsonDefinition $jsonDef,
        $bundleName,
        $bundleDir,
        $bundleNamespace
    ) {

        /** @var ResourceGenerator $generator */
        $generator = $this->resourceGenerator;
        $generator->setGenerateController(false);

        foreach ($this->getSubResources($jsonDef) as $subRecource) {
            $generator->setJson(new JsonDefinition($subRecource->getDef()->setIsSubDocument(true)));
            $generator->generate(
                $bundleDir,
                $bundleNamespace,
                $bundleName,
                $subRecource->getId()
            );
        }

        // main resources
        if (!empty($jsonDef->getFields())) {
            $generator->setGenerateController(true);

            $routerBase = $jsonDef->getRouterBase();
            if ($routerBase === false || $this->isNotWhitelistedController($routerBase)) {
                $generator->setGenerateController(false);
            }

            $generator->setJson(new JsonDefinition($jsonDef->getDef()));
            $generator->generate(
                $bundleDir,
                $bundleNamespace,
                $bundleName,
                $jsonDef->getId()
            );
        }
    }
protected function generateResources ( JsonDefinition $ jsonDef , $ bundleName , $ bundleDir , $ bundleNamespace ) { /** @var ResourceGenerator $generator */ $ generator = $ this -> resourceGenerator ; $ generator -> setGenerateController ( false ) ; foreach ( $ this -> getSubResources ( $ jsonDef ) as $ subRecource ) { $ generator -> setJson ( new JsonDefinition ( $ subRecource -> getDef ( ) -> setIsSubDocument ( true ) ) ) ; $ generator -> generate ( $ bundleDir , $ bundleNamespace , $ bundleName , $ subRecource -> getId ( ) ) ; } // main resources if ( ! empty ( $ jsonDef -> getFields ( ) ) ) { $ generator -> setGenerateController ( true ) ; $ routerBase = $ jsonDef -> getRouterBase ( ) ; if ( $ routerBase === false || $ this -> isNotWhitelistedController ( $ routerBase ) ) { $ generator -> setGenerateController ( false ) ; } $ generator -> setJson ( new JsonDefinition ( $ jsonDef -> getDef ( ) ) ) ; $ generator -> generate ( $ bundleDir , $ bundleNamespace , $ bundleName , $ jsonDef -> getId ( ) ) ; } }
generates the resources of a bundle

@param JsonDefinition $jsonDef         definition
@param string         $bundleName      name
@param string         $bundleDir       dir
@param string         $bundleNamespace namespace

@return void
generates the resources of a bundle