Generates the index.html.twig template in the final bundle.

@param string $dir The path to the folder that hosts templates in the bundle
978800
protected function generateIndexView($dir)
    {
        $this->renderFile('crud/views/index.html.twig.twig', $dir.'/index.html.twig', array(
            'bundle' => $this->bundle->getName(),
            'entity' => $this->entity,
            'entities_name' => strtolower(Inflector::pluralize($this->entity)),
            'fields' => $this->metadata->fieldMappings,
            'actions' => $this->actions,
            'record_actions' => $this->getRecordActions(),
            'route_prefix' => $this->routePrefix,
            'route_name_prefix' => $this->routeNamePrefix,
            'dir' => $dir,
        ));
    }
382247
public function setProjectDirectory(string $dir): Application
    {
        if (is_dir($dir)) {
            $this->projectDir = $dir;
        }

        return $this;
    }
1278196
protected function generateTemplate($tplDir, $domain = '')
    {
        $templatesDir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($tplDir), \RecursiveIteratorIterator::LEAVES_ONLY);
        foreach ($templatesDir as $file) {
            // force compilation
            if ($file->isFile()) {
                try {
                    $this->tpl->load(str_replace($tplDir . '/', '', $file));
                } catch (\Exception $e) {
                    Logger::log($e->getMessage(), LOG_ERR, ['file' => $e->getFile(), 'line' => $e->getLine()]);
                }
            }
        }
        return str_replace('%d', $domain, str_replace('%s', $tplDir, t('Generando plantillas en path "%s" para el dominio "%d"')));
    }
139422
public function mkDirRecursive($dir)
	{
		$parts = explode('/', $dir);
		$path = '';
		while (!empty($parts)) {
			$path .= array_shift($parts);
			try {
				if ($path !== '') $this->mkdir($path);
			} catch (FtpException $e) {
				if (!$this->isDir($path)) {
					throw new FtpException("Cannot create directory '$path'.");
				}
			}
			$path .= '/';
		}
	}
1056870
public function setDir($dir) {
        if (false === in_array($dir, DataTablesEnumerator::enumDirs())) {
            $dir = self::DATATABLES_DIR_ASC;
        }
        $this->dir = strtoupper($dir);
        return $this;
    }
1223845
private function generateTemplatesCache()
    {
        /** @var \Twig_Loader_Filesystem $loader */
        $loader = $this->tpl->getLoader();
        $availablePaths = $loader->getPaths();
        if (!empty($availablePaths)) {
            foreach ($availablePaths as $path) {
                $this->generateTemplate($path);
            }
        }
    }
268724
protected function generateEditView($dir)
    {
        $parts = explode('\\', $this->entity);
        $entityClass = array_pop($parts);

        $this->renderFile(
            'views/edit.html.twig',
            $dir.'/edit.html.twig',
            array(
                'dir' => $this->skeletonDir,
                'route_prefix' => $this->routePrefix,
                'route_name_prefix' => $this->routeNamePrefix,
                'entity' => $this->entity,
                'actions' => $this->actions,
                'bundle' => $this->bundle->getName(),
                'entity_class' => $entityClass,
            )
        );
    }
325158
protected function makeDir($dir)
    {
        $dirPath = base_path('app/'.ltrim($dir, '/'));

        if (!File::exists($dirPath)) {
            File::makeDirectory($dirPath);
        }
    }
1067722
public function withDir(string $dir): self
    {
        $builder = clone $this;
        $builder->dir = $dir;
        
        return $builder;
    }
540408
public function twigLoadFileTemplate ($template_file = null, $template_dir_list = [], $options = []) {
		if (isset($this->textTemplate)) {
			return $this->twigLoadStringTemplate($this->textTemplate, $template_dir_list);
		}

		$twig = $this->twigTemplateSetting(null, $template_dir_list, $options);
		$this->templateDir = $this->templateDir ?: $this->controller;
		$this->template = $this->template ?: $this->action;

		if ($template_file === null) {
			if (!isset($this->templateFile) || $this->templateFile === null) {
				$this->templateFile = PathTrait::CreateFilePath([implode('.', [Strings::ToSnakeCase($this->template), $this->mimeType, 'twig'])]);
			}
			$template_file = $this->templateFile;
		}

		return $twig->loadTemplate($template_file);
	}
981798
public function generate($namespace, $bundle, $dir, $format, $structure, $dbDriver)
    {
        $dir .= '/'.strtr($namespace, '\\', '/');
        if (file_exists($dir)) {
            if (!is_dir($dir)) {
                throw new \RuntimeException(sprintf('Unable to generate the bundle as the target directory "%s" exists but is a file.', realpath($dir)));
            }
            $files = scandir($dir);
            if ($files != array('.', '..')) {
                throw new \RuntimeException(sprintf('Unable to generate the bundle as the target directory "%s" is not empty.', realpath($dir)));
            }
            if (!is_writable($dir)) {
                throw new \RuntimeException(sprintf('Unable to generate the bundle as the target directory "%s" is not writable.', realpath($dir)));
            }
        }

        $driverDir = array(
            'orm' => 'Entity',
            'mongodb' => 'Document',
            'couchdb' => 'CouchDocument',
            'custom' => 'Model',
        );

        $basename = substr($bundle, 0, -6);
        $parameters = array(
            'namespace' => $namespace,
            'bundle' => $bundle,
            'format' => $format,
            'db_driver' => $dbDriver,
            'model_namespace' => $namespace.'\\'.$driverDir[$dbDriver],
            'bundle_basename' => $basename,
            'extension_alias' => Container::underscore($basename),
        );

        $this->renderFile('bundle/Bundle.php.twig', $dir.'/'.$bundle.'.php', $parameters);
        $this->renderFile('bundle/Extension.php.twig', $dir.'/DependencyInjection/'.$basename.'Extension.php', $parameters);
        $this->renderFile('bundle/Configuration.php.twig', $dir.'/DependencyInjection/Configuration.php', $parameters);
        $this->renderFile('bundle/DefaultController.php.twig', $dir.'/Controller/DefaultController.php', $parameters);
        $this->renderFile('bundle/DefaultControllerTest.php.twig', $dir.'/Tests/Controller/DefaultControllerTest.php', $parameters);
        $this->renderFile('bundle/index.html.twig.twig', $dir.'/Resources/views/Default/index.html.twig', $parameters);
        $this->renderFile('bundle/services.'.$format.'.twig', $dir.'/Resources/config/services.'.$format, $parameters);

        $this->generateRoutes($namespace, $bundle, $dir, $format, $basename);
        $this->generateModels($namespace, $bundle, $dir, $dbDriver, $basename);
        $this->generateEventsClass($namespace, $bundle, $dir, $dbDriver, $basename);

        if ($structure) {
            $this->renderFile('bundle/messages.fr.xlf', $dir.'/Resources/translations/messages.fr.xlf', $parameters);

            $this->filesystem->mkdir($dir.'/Resources/doc');
            $this->filesystem->touch($dir.'/Resources/doc/index.rst');
            $this->filesystem->mkdir($dir.'/Resources/translations');
            $this->filesystem->mkdir($dir.'/Resources/public/css');
            $this->filesystem->mkdir($dir.'/Resources/public/images');
            $this->filesystem->mkdir($dir.'/Resources/public/js');
        }
    }
37526
public function initializeTemplate($directory = null)
	{
		if (empty($directory)) {
			$directory = $this->config->resolvePath('views');
		}

		$this->template = new Template($directory);
	}
575816
public function setTemplatesDirectory($directory)
    {
        $this->templatesDirectory = rtrim($directory, DIRECTORY_SEPARATOR);
		$this->engine->setDirectory($this->getTemplatesDirectory());
    }
593919
public function rmdir($dir) {
		$this->connectIfNeeded();
		$this->handle->rmdir($dir);
		$this->onFolderDeleted(new Event(['sender' => $this, 'data' => $dir]));
	}
192379
protected function generateIndexView(AbstractResourceBundle $bundle, &$summary)
    {
        $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/index.html.twig';

        if (file_exists($path)) {
            $summary[] = '';
            $summary[] = '<bg=red>Index view already exist.</>';

            return;
        }

        $this->renderFile('crud/index.html.twig.twig',
            $path,
            array(
                'bundle'  => $bundle->getName(),
                'model'   => $this->model,
                'prefix'  => $this->getBundlePrefix($bundle),
                'vars'    => strtolower(Inflector::pluralize($this->model)),
                'actions' => array(
                    'add' => strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_create')
                )
            )
        );

        $summary[] = '';
        $summary[] = '<bg=green>Index view created.</>';
    }
39186
public function generate($namespace, $bundle, $dir)
    {
        $dir .= '/' . strtr($namespace, '\\', '/');
        if (file_exists($dir)) {
            throw new \RuntimeException(sprintf('Unable to generate the bundle as the target directory "%s" is not empty.', realpath($dir)));
        }

        $basename = substr($bundle, 0, -6);
        $parameters = array(
            'namespace' => $namespace,
            'bundle' => $bundle,
            'bundle_basename' => $basename,
            'extension_alias' => Container::underscore($basename),
        );

        $this->renderFile('/bundle/Bundle.php', $dir . '/' . $bundle . '.php', $parameters);
        $this->renderFile('/bundle/Extension.php', $dir . '/DependencyInjection/' . $basename . 'Extension.php', $parameters);
        $this->renderFile('/bundle/Configuration.php', $dir . '/DependencyInjection/Configuration.php', $parameters);
        $this->renderFile('/bundle/DefaultController.php', $dir . '/Controller/DefaultController.php', $parameters);
        $this->renderFile('/bundle/index.html.twig', $dir . '/Resources/views/Default/index.html.twig', $parameters);

        $this->renderFile('/bundle/services.yml', $dir . '/Resources/config/services.yml', $parameters);
        $this->renderFile('/bundle/routing.yml', $dir . '/Resources/config/routing.yml', $parameters);
    }
1155014
public function initializeTemplate($directory = null)
	{
		if (empty($directory)) {
			$directory = $this->config->resolvePath('views');
		}

		// Remember what directory was set. We may have to reinitialize the template later and don't want to lose the previous setting.
		$this->views_directory = $directory;

		$this->template = new Template($directory, $this->config);

		// Add our url builder to the template.
		$extension = new \werx\Url\Extensions\Plates(null, null, $this->expose_script_name);
		$this->template->loadExtension($extension);
	}