8000 Fixed usage of default configuration in PHP by HeahDude · Pull Request #8232 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Fixed usage of default configuration in PHP #8232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

HeahDude
Copy link
Contributor

Fixes #7922.

@HeahDude
Copy link
Contributor Author
HeahDude commented Jul 27, 2017

For the record, using:

<?php

use AppBundle\Command\ListUsersCommand;
use AppBundle\EventListener\CommentNotificationSubscriber;
use AppBundle\EventListener\RedirectToPreferredLocaleSubscriber;
use AppBundle\Twig\AppExtension;
use AppBundle\Utils\Slugger;
use Symfony\Component\DependencyInjection\Definition;
use Twig\Extensions\IntlExtension;

$definition = new Definition();
        
$definition
    ->setAutowired(true)
    ->setAutoconfigured(true)
    ->setPublic(false)
;

$this->registerClasses($definition, 'AppBundle\\', '../../src/AppBundle/*', '../../src/AppBundle/{Controller,Entity,Repository}');

$definition
    ->setPublic(true)
    ->addTag('controller.service_arguments')
;

$this->registerClasses($definition, 'AppBundle\\Controller\\', '../../src/AppBundle/Controller/*');

$container->getDefinition(ListUsersCommand::class)
    ->setArgument('$emailSender', '%app.notifications.email_sender%')
;
$container->getDefinition(AppExtension::class)
    ->setArgument('$locales', '%app_locales%')
;
$container->getDefinition(CommentNotificationSubscriber::class)
    ->setArgument('$sender', '%app.notifications.email_sender%')
;
$container->getDefinition(RedirectToPreferredLocaleSubscriber::class)
    ->setArgument('$locales', '%app_locales%')
    ->setArgument('$defaultLocale', '%locale%')
;
$container->getDefinition(Slugger::class)
    ->setPublic(true)
;
$container->setAlias('slugger', Slugger::class);
$container->register(IntlExtension::class)
    ->addTag('twig.extension')
;

in https://github.com/symfony/symfony-demo worked like a charm :).

@HeahDude HeahDude force-pushed the fix/di-php_register_classes branch from 3430fd3 to d00a3c8 Compare July 27, 2017 13:00
@xabbuh xabbuh changed the base branch from 3.4 to 3.3 July 28, 2017 06:20
@xabbuh
Copy link
Member
xabbuh commented Aug 1, 2017

Thank you @HeahDude.

xabbuh added a commit that referenced this pull request Aug 1, 2017
This PR was squashed before being merged into the 3.3 branch (closes #8232).

Discussion
----------

Fixed usage of default configuration in PHP

Fixes #7922.

Commits
-------

b688556 Fixed usage of default configuration in PHP
@xabbuh xabbuh closed this Aug 1, 2017
@HeahDude HeahDude deleted the fix/di-php_register_classes branch August 1, 2017 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0