У меня есть микроядро Symfony, и я пытаюсь добавить FOSUserBundle. После прохождения этого руководства, чтобы установить его https://symfony.com/doc/master/bundles/FOSUserBundle/index.html я получил ошибку с 'validor.builder'Symfony3 Вы запросили несуществующий сервис «validator.builder», а добавьте FOSUserBundle
Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "validator.builder". in /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php on line 754
Call Stack
/app_dev.php:0 Symfony \ Component \ HttpKernel \ kernel-> ручка ( ) .../app_dev.php: 9 Symfony \ Component \ HttpKernel \ Kernel-> boot ( ) .../Kernel.php: 166 Symfony \ Component \ HttpKernel \ Kernel-> initializeContainer ( ) .. ./Kernel.php:117 Symfony \ Component \ DependencyInjection \ ContainerBuilder-> compile (0123)) .../Kernel.php: процесс 528 FOS \ UserBundle \ внедрение зависимости \ Compiler \ ValidationPass-> (: 477 Symfony \ Component \ внедрение зависимости \ Compiler \ от компилятора> компиляции ( ) .../ContainerBuilder.php ) .../Compiler.php: 104 Symfony \ Component \ внедрение зависимости \ ContainerBuilder-> getDefinition ( ) .../ValidationPass.php: 41
Это швы, что Symfony не может найти сервис валидатор. builder, который идет с symfony FrameworkBundle. У кого-нибудь есть предложения, где проблема, а что отсутствует? Спасибо!
Composer.json:
{
"require": {
"symfony/symfony": "^3.1",
"symfony/security": "^3.1",
"symfony/monolog-bundle": "^3.0",
"twig/twig": "^1.28",
"alcaeus/mongo-php-adapter": "^1.0",
"ext-mongo": "*",
"mongodb/mongodb": "^1.0",
"doctrine/mongodb-odm": "^1.1",
"doctrine/mongodb-odm-bundle": "^3.2",
"friendsofsymfony/user-bundle": "[email protected]",
"symfony/validator": "^3.1"
},
"autoload": {
"psr-4": {
"": "src/"
}
} }
App_dev.php
<?php
use Symfony\Component\HttpFoundation\Request;
require __DIR__.'/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
AppKernel.php
<?php
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
// require Composer's autoloader
$loader = require __DIR__.'/../vendor/autoload.php';
class AppKernel extends Kernel
{
use MicroKernelTrait;
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new DebatesBundle\DebatesBundle(),
new Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle(),
new FOS\UserBundle\FOSUserBundle(),
new Exten\FOSUserBundle\ExtenFOSUserBundle()
);
if ($this->getEnvironment() == 'dev') {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new \Symfony\Bundle\DebugBundle\DebugBundle();
}
return $bundles;
}
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
{
$loader->load(__DIR__ . '/config/config.yml');
$loader->load(__DIR__.'/config/parameters.'.$this->getEnvironment().'.yml');
// configure WebProfilerBundle only if the bundle is enabled
if (isset($this->bundles['WebProfilerBundle'])) {
$c->loadFromExtension('web_profiler', array(
'toolbar' => true,
'intercept_redirects' => false,
));
}
$loader->load(__DIR__.'/config/services.yml');
}
protected function configureRoutes(RouteCollectionBuilder $routes)
{
$routes->import(__DIR__ . '/../src/DebatesBundle/Routes/routes.yml', '/', 'yaml');
$routes->import('@FOSUserBundle/Resources/config/routing/all.xml', '/');
// import the WebProfilerRoutes, only if the bundle is enabled
if (isset($this->bundles['WebProfilerBundle'])) {
$routes->import('@WebProfilerBundle/Resources/config/routing/wdt.xml', '/_wdt');
$routes->import('@WebProfilerBundle/Resources/config/routing/profiler.xml', '/_profiler');
}
}
// optional, to use the standard Symfony cache directory
public function getCacheDir()
{
return __DIR__ . '/cache/' .$this->getEnvironment();
}
// optional, to use the standard Symfony logs directory
public function getLogDir()
{
return __DIR__ . '/logs';
}
}
Какую версию Symfony вы используете? Можете ли вы опубликовать свой композитор.json? – mickadoo
Я пытаюсь создать фреймворк с MicroKernel, как, например, заранее на этой странице http://symfony.com/doc/current/configuration/micro_kernel_trait.html – PVN
Обновленное описание с моим файлом composer.json. – PVN