src/Graviton/GeneratorBundle/Generator/ResourceGenerator.php
public function generate(
        $bundleDir,
        $bundleNamespace,
        $bundleName,
        $document
    ) {
        $this->readServicesAndParams($bundleDir);

        $basename = $this->getBundleBaseName($document);

        if (!is_null($this->json)) {
            $this->json->setNamespace($bundleNamespace);
        }

        // add more info to the fields array
        $mapper = $this->mapper;
        $fields = array_map(
            function ($field) use ($mapper) {
                return $mapper->map($field, $this->json);
            },
            $this->mapper->buildFields($this->json)
        );

        $parameters = $this->parameterBuilder
            ->reset()
            ->setParameter('document', $document)
            ->setParameter('base', $bundleNamespace)
            ->setParameter('bundle', $bundleName)
            ->setParameter('json', $this->json)
            ->setParameter('fields', $fields)
            ->setParameter('basename', $basename)
            ->setParameter('isrecordOriginFlagSet', $this->json->isRecordOriginFlagSet())
            ->setParameter('recordOriginModifiable', $this->json->isRecordOriginModifiable())
            ->setParameter('isVersioning', $this->json->isVersionedService())
            ->setParameter('collection', $this->json->getServiceCollection())
            ->setParameter('indexes', $this->json->getIndexes())
            ->setParameter('textIndexes', $this->json->getAllTextIndexes())
            ->setParameter('solrFields', $this->json->getSolrFields())
            ->setParameter('solrAggregate', $this->json->getSolrAggregate())
            ->getParameters();

        $this->generateDocument($parameters, $bundleDir, $document);
        $this->generateSerializer($parameters, $bundleDir, $document);
        $this->generateModel($parameters, $bundleDir, $document);

        if ($this->json instanceof JsonDefinition && $this->json->hasFixtures() === true) {
            $this->generateFixtures($parameters, $bundleDir, $document);
        }

        if ($this->generateController) {
            $this->generateController($parameters, $bundleDir, $document);
        }

        $this->persistServicesAndParams();
    }
public function generate(
        $bundleDir,
        $bundleNamespace,
        $bundleName,
        $document
    ) {
        $this->readServicesAndParams($bundleDir);

        $basename = $this->getBundleBaseName($document);

        if (!is_null($this->json)) {
            $this->json->setNamespace($bundleNamespace);
        }

        // add more info to the fields array
        $mapper = $this->mapper;
        $fields = array_map(
            function ($field) use ($mapper) {
                return $mapper->map($field, $this->json);
            },
            $this->mapper->buildFields($this->json)
        );

        $parameters = $this->parameterBuilder
            ->reset()
            ->setParameter('document', $document)
            ->setParameter('base', $bundleNamespace)
            ->setParameter('bundle', $bundleName)
            ->setParameter('json', $this->json)
            ->setParameter('fields', $fields)
            ->setParameter('basename', $basename)
            ->setParameter('isrecordOriginFlagSet', $this->json->isRecordOriginFlagSet())
            ->setParameter('recordOriginModifiable', $this->json->isRecordOriginModifiable())
            ->setParameter('isVersioning', $this->json->isVersionedService())
            ->setParameter('collection', $this->json->getServiceCollection())
            ->setParameter('indexes', $this->json->getIndexes())
            ->setParameter('textIndexes', $this->json->getAllTextIndexes())
            ->setParameter('solrFields', $this->json->getSolrFields())
            ->setParameter('solrAggregate', $this->json->getSolrAggregate())
            ->getParameters();

        $this->generateDocument($parameters, $bundleDir, $document);
        $this->generateSerializer($parameters, $bundleDir, $document);
        $this->generateModel($parameters, $bundleDir, $document);

        if ($this->json instanceof JsonDefinition && $this->json->hasFixtures() === true) {
            $this->generateFixtures($parameters, $bundleDir, $document);
        }

        if ($this->generateController) {
            $this->generateController($parameters, $bundleDir, $document);
        }

        $this->persistServicesAndParams();
    }
public function generate ( $ bundleDir , $ bundleNamespace , $ bundleName , $ document ) { $ this -> readServicesAndParams ( $ bundleDir ) ; $ basename = $ this -> getBundleBaseName ( $ document ) ; if ( ! is_null ( $ this -> json ) ) { $ this -> json -> setNamespace ( $ bundleNamespace ) ; } // add more info to the fields array $ mapper = $ this -> mapper ; $ fields = array_map ( function ( $ field ) use ( $ mapper ) { return $ mapper -> map ( $ field , $ this -> json ) ; } , $ this -> mapper -> buildFields ( $ this -> json ) ) ; $ parameters = $ this -> parameterBuilder -> reset ( ) -> setParameter ( 'document' , $ document ) -> setParameter ( 'base' , $ bundleNamespace ) -> setParameter ( 'bundle' , $ bundleName ) -> setParameter ( 'json' , $ this -> json ) -> setParameter ( 'fields' , $ fields ) -> setParameter ( 'basename' , $ basename ) -> setParameter ( 'isrecordOriginFlagSet' , $ this -> json -> isRecordOriginFlagSet ( ) ) -> setParameter ( 'recordOriginModifiable' , $ this -> json -> isRecordOriginModifiable ( ) ) -> setParameter ( 'isVersioning' , $ this -> json -> isVersionedService ( ) ) -> setParameter ( 'collection' , $ this -> json -> getServiceCollection ( ) ) -> setParameter ( 'indexes' , $ this -> json -> getIndexes ( ) ) -> setParameter ( 'textIndexes' , $ this -> json -> getAllTextIndexes ( ) ) -> setParameter ( 'solrFields' , $ this -> json -> getSolrFields ( ) ) -> setParameter ( 'solrAggregate' , $ this -> json -> getSolrAggregate ( ) ) -> getParameters ( ) ; $ this -> generateDocument ( $ parameters , $ bundleDir , $ document ) ; $ this -> generateSerializer ( $ parameters , $ bundleDir , $ document ) ; $ this -> generateModel ( $ parameters , $ bundleDir , $ document ) ; if ( $ this -> json instanceof JsonDefinition && $ this -> json -> hasFixtures ( ) === true ) { $ this -> generateFixtures ( $ parameters , $ bundleDir , $ document ) ; } if ( $ this -> generateController ) { $ this -> generateController ( $ parameters , $ bundleDir , $ document ) ; } $ this -> persistServicesAndParams ( ) ; }
generate the resource with all its bits and parts

@param string $bundleDir       bundle dir
@param string $bundleNamespace bundle namespace
@param string $bundleName      bundle name
@param string $document        document name

@return void
generate the resource with all its bits and parts