Skip to content

Commit 864be12

Browse files
committed
Register spl_autoloader sooner to work with Symfony3+
Remove invalid block call
1 parent 6135b81 commit 864be12

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

AdmingeneratorGeneratorBundle.php

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,7 @@ class AdmingeneratorGeneratorBundle extends Bundle
2929
public function __construct(KernelInterface $kernel)
3030
{
3131
$this->kernel = $kernel;
32-
}
33-
34-
/**
35-
* (non-PHPdoc)
36-
* @see \Symfony\Component\HttpKernel\Bundle\Bundle::boot()
37-
*/
38-
public function boot()
39-
{
40-
$this->initAdmingeneratorClassLoader($this->container);
32+
$this->initAdmingeneratorClassLoader($kernel->getCacheDir());
4133
}
4234

4335
/**
@@ -46,8 +38,6 @@ public function boot()
4638
*/
4739
public function build(ContainerBuilder $container)
4840
{
49-
$this->initAdmingeneratorClassLoader($container);
50-
5141
parent::build($container);
5242

5343
$container->addCompilerPass(new ValidatorPass());
@@ -68,16 +58,18 @@ public function getContainerExtension()
6858
/**
6959
* Initialize Admingenerator Class loader
7060
*
71-
* @param ContainerBuilder $container
61+
* @param string $cacheDir
7262
*/
73-
private function initAdmingeneratorClassLoader(ContainerInterface $container)
63+
private function initAdmingeneratorClassLoader($cacheDir)
7464
{
75-
if (!$this->classLoaderInitialized) {
76-
$this->classLoaderInitialized = true;
77-
78-
$admingeneratedClassLoader = new AdmingeneratedClassLoader();
79-
$admingeneratedClassLoader->setBasePath($container->getParameter('kernel.cache_dir'));
80-
$admingeneratedClassLoader->register();
65+
if ($this->classLoaderInitialized) {
66+
return;
8167
}
68+
69+
$this->classLoaderInitialized = true;
70+
71+
$admingeneratedClassLoader = new AdmingeneratedClassLoader();
72+
$admingeneratedClassLoader->setBasePath($cacheDir);
73+
$admingeneratedClassLoader->register();
8274
}
8375
}

Resources/templates/CommonAdmin/ListTemplate/thead.php.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
<th class="list-results-fields-header-column list-results-fields-header-column-{{ column.name|lower }}{{ echo_if (column.isSortable) }} sorting{{ echo_if ("sortColumn == '" ~ column.sortOn ~ "' and sortOrder == 'ASC'") }}_asc{{ echo_elseif ("sortColumn == '" ~ column.sortOn ~ "' and sortOrder == 'DESC'") }}_desc{{ echo_endif () }}{{ echo_endif () }}">
3838
{% if column.isSortable -%}
3939
{{ echo_if ("sortColumn == '" ~ column.sortOn ~ "' and sortOrder == 'ASC'") }}
40-
<a href="{{ echo_twig("path(listRoute, { 'sort': '" ~ column.sortOn ~ "', 'order_by': 'desc'})") }}" class="{{ block('sort_icon') }}">
40+
<a href="{{ echo_twig("path(listRoute, { 'sort': '" ~ column.sortOn ~ "', 'order_by': 'desc'})") }}">
4141
{{ echo_else() }}
42-
<a href="{{ echo_twig("path(listRoute, { 'sort': '" ~ column.sortOn ~ "', 'order_by': 'asc'})") }}" class="{{ block('sort_icon') }}">
42+
<a href="{{ echo_twig("path(listRoute, { 'sort': '" ~ column.sortOn ~ "', 'order_by': 'asc'})") }}">
4343
{{ echo_endif () }}
4444
{%- endif -%}
4545
{{ echo_twig("'" ~ column.label|addslashes ~ "'|trans({}, '" ~ i18n_catalog|default("Admin") ~ "')") }}

0 commit comments

Comments
 (0)