Generator/Template/Crud.php
protected function generateMacrosView(AbstractResourceBundle $bundle)
    {
        $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/macros.html.twig';

        if (!file_exists($path)) {
            $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model;
            $metadata = $this->getEntityMetadata($entityClass);
            $identifier = $this->getContainer()->get('doctrine')
                ->getManager()
                ->getClassMetadata($entityClass)
                ->getIdentifier();

            $actions = array();
            array_map(function($key) use ($bundle, &$actions) {
                if (in_array($key, array('show', 'update'))) {
                    $actions[$key] = strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_' . $key);
                }
            }, $this->configuration['actions']);

            $actions['delete'] = strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_delete');

            $this->renderFile('crud/macros.html.twig.twig',
                $bundle->getPath() . '/Resources/views/' . $this->model . '/macros.html.twig',
                array(
                    'bundle'  => $bundle->getName(),
                    'model'   => $this->model,
                    'prefix'  => $this->getBundlePrefix($bundle),
                    'vars'    => strtolower(Inflector::pluralize($this->model)),
                    'identifier' => $identifier[0],
                    'fields'  => $this->getFieldsFromMetadata($metadata[0]),
                    'actions' => $actions
                )
            );
        }
    }
protected function generateMacrosView(AbstractResourceBundle $bundle)
    {
        $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/macros.html.twig';

        if (!file_exists($path)) {
            $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model;
            $metadata = $this->getEntityMetadata($entityClass);
            $identifier = $this->getContainer()->get('doctrine')
                ->getManager()
                ->getClassMetadata($entityClass)
                ->getIdentifier();

            $actions = array();
            array_map(function($key) use ($bundle, &$actions) {
                if (in_array($key, array('show', 'update'))) {
                    $actions[$key] = strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_' . $key);
                }
            }, $this->configuration['actions']);

            $actions['delete'] = strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_delete');

            $this->renderFile('crud/macros.html.twig.twig',
                $bundle->getPath() . '/Resources/views/' . $this->model . '/macros.html.twig',
                array(
                    'bundle'  => $bundle->getName(),
                    'model'   => $this->model,
                    'prefix'  => $this->getBundlePrefix($bundle),
                    'vars'    => strtolower(Inflector::pluralize($this->model)),
                    'identifier' => $identifier[0],
                    'fields'  => $this->getFieldsFromMetadata($metadata[0]),
                    'actions' => $actions
                )
            );
        }
    }
protected function generateMacrosView ( AbstractResourceBundle $ bundle ) { $ path = $ bundle -> getPath ( ) . '/Resources/views/' . $ this -> model . '/macros.html.twig' ; if ( ! file_exists ( $ path ) ) { $ entityClass = $ this -> getContainer ( ) -> get ( 'doctrine' ) -> getAliasNamespace ( $ this -> bundle -> getName ( ) ) . '\\' . $ this -> model ; $ metadata = $ this -> getEntityMetadata ( $ entityClass ) ; $ identifier = $ this -> getContainer ( ) -> get ( 'doctrine' ) -> getManager ( ) -> getClassMetadata ( $ entityClass ) -> getIdentifier ( ) ; $ actions = array ( ) ; array_map ( function ( $ key ) use ( $ bundle , & $ actions ) { if ( in_array ( $ key , array ( 'show' , 'update' ) ) ) { $ actions [ $ key ] = strtolower ( $ this -> getBundlePrefix ( $ bundle ) . '_' . $ this -> model . '_' . $ key ) ; } } , $ this -> configuration [ 'actions' ] ) ; $ actions [ 'delete' ] = strtolower ( $ this -> getBundlePrefix ( $ bundle ) . '_' . $ this -> model . '_delete' ) ; $ this -> renderFile ( 'crud/macros.html.twig.twig' , $ bundle -> getPath ( ) . '/Resources/views/' . $ this -> model . '/macros.html.twig' , array ( 'bundle' => $ bundle -> getName ( ) , 'model' => $ this -> model , 'prefix' => $ this -> getBundlePrefix ( $ bundle ) , 'vars' => strtolower ( Inflector :: pluralize ( $ this -> model ) ) , 'identifier' => $ identifier [ 0 ] , 'fields' => $ this -> getFieldsFromMetadata ( $ metadata [ 0 ] ) , 'actions' => $ actions ) ) ; } }
Generate macros view

@param AbstractResourceBundle $bundle
Generate macros view