예제 #1
0
 /**
  * Generate show view
  *
  * @param AbstractResourceBundle $bundle
  */
 protected function generateShowView(AbstractResourceBundle $bundle, &$summary)
 {
     $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/show.html.twig';
     $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model;
     $identifier = $this->getContainer()->get('doctrine')->getManager()->getClassMetadata($entityClass)->getIdentifier();
     if (file_exists($path)) {
         $summary[] = '';
         $summary[] = '<bg=red>Show view already exist.</>';
         return;
     }
     $this->renderFile('crud/show.html.twig.twig', $path, array('bundle' => $bundle->getName(), 'model' => $this->model, 'identifier' => $identifier[0], 'prefix' => $this->getBundlePrefix($bundle), 'cancel' => strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_index'), 'actions' => array('edit' => strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_update'))));
     $summary[] = '';
     $summary[] = '<bg=green>Show view created.</>';
 }