Closed cboelter closed 9 years ago
same here...
My quickfix solution is the following:
if(is_array($GLOBALS['TL_HOOKS']['getPageLayout'])) {
$container['page-provider'] = new PageProvider();
$GLOBALS['TL_HOOKS']['getPageLayout'] = array_merge(
array(array('DependencyInjection\Container\PageProvider', 'setPage')),
$GLOBALS['TL_HOOKS']['getPageLayout']
);
}
Thanks. I switched back to v1.6.1 (temporary).
Ich fürchte, ich habe diesen quickfix nicht richtig eingefügt. Fehler besteht weiterhin, bzw. ich komme nicht mehr ins Backend. Der betreffende Teil im Code sieht so aus:
/**
* Add the Contao singletons to the DIC.
*
* @param \Pimple $container The DIC to populate.
*
* @return void
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
protected function provideSingletons(\Pimple $container)
{
if (!isset($container['config'])) {
$container['config'] = $container->share($this->getConfigProvider());
}
if (!isset($container['environment'])) {
$container['environment'] = $container->share($this->getEnvironmentProvider());
}
if (!isset($container['database.connection'])) {
$container['database.connection'] = $container->share($this->getDatabaseProvider());
}
if (!isset($container['input'])) {
$container['input'] = $container->share($this->getInputProvider());
}
if (!isset($container['user'])) {
$container['user'] = $container->share($this->getUserProvider());
}
if (!isset($container['session'])) {
$container['session'] = $container->share($this->getSessionProvider());
}
if (!isset($container['page-provider'])) {
$container['page-provider'] = new PageProvider();
$GLOBALS['TL_HOOKS']['getPageLayout'] = array_merge(
array(array('DependencyInjection\Container\PageProvider', 'setPage')),
$GLOBALS['TL_HOOKS']['getPageLayout']
);
}
if(is_array($GLOBALS['TL_HOOKS']['getPageLayout'])) {
$container['page-provider'] = new PageProvider();
$GLOBALS['TL_HOOKS']['getPageLayout'] = array_merge(
array(array('DependencyInjection\Container\PageProvider', 'setPage')),
$GLOBALS['TL_HOOKS']['getPageLayout']
);
}
}
Ist das korrekt?
nope leider nicht korrekt, du musst das hier ...
$container['page-provider'] = new PageProvider();
$GLOBALS['TL_HOOKS']['getPageLayout'] = array_merge(
array(array('DependencyInjection\Container\PageProvider', 'setPage')),
$GLOBALS['TL_HOOKS']['getPageLayout']
);
Entfernen und durch den Code von mir erstzen. Die komplette funktion muss so aussehen:
/**
* Add the Contao singletons to the DIC.
*
* @param \Pimple $container The DIC to populate.
*
* @return void
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
protected function provideSingletons(\Pimple $container)
{
if (!isset($container['config'])) {
$container['config'] = $container->share($this->getConfigProvider());
}
if (!isset($container['environment'])) {
$container['environment'] = $container->share($this->getEnvironmentProvider());
}
if (!isset($container['database.connection'])) {
$container['database.connection'] = $container->share($this->getDatabaseProvider());
}
if (!isset($container['input'])) {
$container['input'] = $container->share($this->getInputProvider());
}
if (!isset($container['user'])) {
$container['user'] = $container->share($this->getUserProvider());
}
if (!isset($container['session'])) {
$container['session'] = $container->share($this->getSessionProvider());
}
if (!isset($container['page-provider'])) {
if(is_array($GLOBALS['TL_HOOKS']['getPageLayout'])) {
$container['page-provider'] = new PageProvider();
$GLOBALS['TL_HOOKS']['getPageLayout'] = array_merge(
array(array('DependencyInjection\Container\PageProvider', 'setPage')),
$GLOBALS['TL_HOOKS']['getPageLayout']
);
}
}
}
Das hat geklappt, danke!
Has been fixed in 842a8e0726f38b53e08fe977603843f9b05e1bbf
I updated my MetaModels installation via composer, since I've done the update, I get the following error:
I had a look on the requested line and it seems that the $GLOBALS['TL_HOOKS']['getPageLayout'] does not exist at every time. I think we need a condition to check if there is an array or not.