Bonjour,
Voila je rencontre un petit problème avec mon code.
Je cherche à intégrer FOSUserBundle à mon projet SonataAdminBundle. La configuration a été faite, j'ai suivi toutes les étapes indiquées sur ce lien : https://sonata-project.org/bundles/user/3-x/doc/reference/installation.html
Par la suite, j'ai fais un extend du FOS bundle sur le dossier src du projet :
php bin/console sonata:easy-extends:generate SonataUserBundle -d src
Mon composer.json :
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"friendsofsymfony/user-bundle": "^2.1",
"sensio/framework-extra-bundle": "^5.1",
"sonata-project/admin-bundle": "^3.48",
"sonata-project/doctrine-orm-admin-bundle": "^3.8",
"sonata-project/user-bundle": "^4.3",
"symfony/acl-bundle": "^1.0",
"symfony/asset": "4.2.*",
"symfony/console": "4.2.*",
"symfony/dotenv": "4.2.*",
"symfony/expression-language": "4.2.*",
"symfony/flex": "^1.1",
"symfony/form": "4.2.*",
"symfony/framework-bundle": "4.2.*",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "*",
"symfony/process": "4.2.*",
"symfony/security-bundle": "4.2.*",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "4.2.*",
"symfony/twig-bundle": "4.2.*",
"symfony/validator": "4.2.*",
"symfony/web-link": "4.2.*",
"symfony/yaml": "4.2.*"
},
"require-dev": {
"symfony/debug-pack": "*",
"symfony/maker-bundle": "^1.0",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/web-server-bundle": "4.2.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.2.*"
}
}
}
Décrivez ici ce que vous cherchez à obtenir
Après tout ça, j'obtiens l'erreur suivante :
Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to loadaround class "ApplicationSonataUserBundle" from namespace "Application\Sonata\UserBundle".aroundDid you forget a "use" statement for another namespace? in C:\wamp64\www\staff\src\Kernel.php:23aroundStack trace:around#0 C:\wamp64\www\staff\vendor\symfony\http-kernel\Kernel.php(424): App\Kernel->registerBundles()around#1 C:\wamp64\www\staff\vendor\symfony\http-kernel\Kernel.php(130): Symfony\Component\HttpKernel\Karoundernel->initializeBundles()around#2 C:\wamp64\www\staff\vendor\symfony\framework-bundle\Console\Application.php(65): Symfony\Compoaroundnent\HttpKernel\Kernel->boot()around#3 C:\wamp64\www\staff\vendor\symfony\console\Application.php(145): Symfony\Bundle\FrameworkBundlarounde\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Coaroundmponent\Console\Output\ConsoleOutput))around#4 C:\wamp64\www\staff\bin\console(38): Symfony\Component\Console\Application->run(Object(Symfonyaround\Component\Console\Input\ArgvInput))around#5 {main}around thrown in C:\wamp64\www\staff\src\Kernel.php on line 23****
Ma classe :
<?php
namespace Application\Sonata\UserBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* This file has been generated by the SonataEasyExtendsBundle.
*
* @link https://sonata-project.org/easy-extends
*
* References:
* @link http://symfony.com/doc/current/book/bundles.html
*/
class ApplicationSonataUserBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function getParent()
{
return 'SonataUserBundle';
}
}
Du coup, j'ai modifié le code suivant :
"autoload": {
"psr-4": {
"App\\": "src/",
"Application\\": "src/Application/"
}
},
Par la suite, j'ai ça comme erreur :
Fatal error: Cannot declare class Application\Sonata\UserBundle\ApplicationSonataUserBundle, beca
use the name is already in use in C:\wamp64\www\staff\src\Application\Sonata\UserBundle\Applicati
onSonataUserBundle.php on line 24
Vous avez une idée sur la raison du problème ?
Merci d'avance