Also nochmal um es verständliche auszudrücken.
Ich habe eigene Bundles unter Root/src, die ich immer weiter entwickle und sie ab und an auf git commite
Wenn ich die Bundles für eine produktive Einsatz über composer require installiere, funktioniert alles einwandfrei.
Am Anfang hatte ich den Fehler, dass die Klasse ContaoManagerPlugin bereits existiert
PHP-Code:
Fatal error: Cannot declare class ContaoManagerPlugin, because the name is already in use
Diese habe ich umbenannt auf CustomContaoManagerPlugin und war das Problem weg.
Jetzt habe ich das Problem mit eigene Bundles, obwohl diese unter C4.4, 4.6 und 4.8 einwandfrei funktioniert haben. Nach der Update auf Contao 4.9 trat das Problem mit dem autoload.
Fehler bei der autoloading:
PHP-Code:
Compile Error: Cannot declare class namespace\MyBundle\Tools\Helper, because the name is already in use
Entferne ich den namespace\MyBundle aus der CustomContaoManagerPlugin.php wird aber trotzdem geladen. ???
Mein ComposerPlugin in SRC-Verzeichnis:
PHP-Code:
use namespace\myBundle\namespaceMyBundle;
class CustomContaoManagerPlugin implements BundlePluginInterface
{
public function getBundles(ParserInterface $parser)
{
return [
BundleConfig::create(namespaceMyBundle::class)
->setLoadAfter([ContaoCoreBundle::class]),
BundleConfig::create(namespaceMyBundle2::class)
->setLoadAfter([ContaoCoreBundle::class]),
...
];
}
}
Root composer.json:
PHP-Code:
{
"name": "contao/managed-edition",
"type": "project",
"description": "Contao Open Source CMS",
"license": "LGPL-3.0-or-later",
"authors": [
{
"name": "Leo Feyer",
"homepage": "https://github.com/leofeyer"
}
],
"require": {
"php": "^7.1",
"cocur/slugify": "^3.2",
"contao/calendar-bundle": "^4.9",
"contao/comments-bundle": "^4.9",
"contao/conflicts": "@dev",
"contao/faq-bundle": "^4.9",
"contao/listing-bundle": "^4.9",
"contao/manager-bundle": "4.9.*",
"contao/news-bundle": "^4.9",
"contao/newsletter-bundle": "^4.9",
...
"madeyourday/contao-rocksolid-icon-picker": "^2.0",
"menatwork/contao-multicolumnwizard-bundle": "^3.4",
"netzmacht/contao-leaflet-maps": "^3.1",
"symfony/intl": "^4.3",
"terminal42/contao-changelanguage": "^3.1"
},
"require-dev": {
"symfony/stopwatch": "^4.4"
},
"conflict": {
"contao-components/installer": "<1.3"
},
"extra": {
"contao-component-dir": "assets",
"symfony": {
"require": "^4.2"
}
},
"scripts": {
"post-install-cmd": [
"Contao\\ManagerBundle\\Composer\\ScriptHandler::initializeApplication"
],
"post-update-cmd": [
"Contao\\ManagerBundle\\Composer\\ScriptHandler::initializeApplication"
]
},
"autoload": {
"classmap": [
"src/ContaoManager/CustomContaoManagerPlugin.php",
"src/namespace/myBundle",
"src/namespace/myBundle2"
],
"psr-4": {
"App\\": "src/"
},
"exclude-from-classmap": [
]
}
}
Lesezeichen