Call to a member function - eigenes Bundle benötigt zusätzliches Bundle
Wenn ich in eigenen Bundles ein anderes Bundle benötige, schreibe ich in der composer.json (von schachbulle/contao-counter-bundle):
PHP-Code:
"require": {
"php": "^5.6 || ^7.0",
"contao/core-bundle": "^4",
"contao/news-bundle": "*",
"schachbulle/contao-helper-bundle": "*"
},
Für das news-bundle reicht das noch nicht, weshalb in src/ContaoManager/Plugin.php steht:
PHP-Code:
public function getBundles(ParserInterface $parser)
{
return [
BundleConfig::create(ContaoCounterBundle::class)
->setLoadAfter([ContaoCoreBundle::class, \Contao\NewsBundle\ContaoNewsBundle::class]),
];
}
Leider scheint es dasselbe Problem auch mit schachbulle/contao-helper-bundle zu geben. Mögliche Ursache: dieses Bundle wird erst nach schachbulle/contao-counter-bundle geladen, weswegen die Funktion (Call to a member function ...) nicht gefunden wird. Ich tippe mal, das ich auch hier setLoadAfter bedienen muß - und versuchte:
PHP-Code:
public function getBundles(ParserInterface $parser)
{
return [
BundleConfig::create(ContaoCounterBundle::class)
->setLoadAfter([ContaoCoreBundle::class, \Contao\NewsBundle\ContaoNewsBundle::class, \Schachbulle\ContaoHelperBundle\ContaoHelperBundle::class]),
];
}
Wahlweise auch \Schachbulle\ContaoHelperBundle\Classes::class oder \Schachbulle\ContaoHelperBundle\classes\Cache::cla ss oder \Schachbulle\ContaoHelperBundle::class. Keine Variante scheint zu funktionieren.
ContaoCounterBundle: https://github.com/Samson1964/contao-counter-bundle
ContaoHelperBundle: https://github.com/Samson1964/contao-helper-bundle