-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Conversation
Awesome! This was on my list! We need this for the docs: we need to be able to assume that new users (at least) have a certain set of config. This config is subjective, let's try to find a really "good" first attempt :). The only part I'm not sure about is public: false - I feel like we should spend some time training users to not use the container as a locator, then begins taking this ability away a bit later. Oh, maybe add a few comments. Like for the main service loader, comment that it adds a service for each class and that you can add whatever directories you need. Thanks! |
app/config/services.yml
Outdated
public: false | ||
|
||
AppBundle\: | ||
resource: '../../src/AppBundle/{Command,Form,EventSubscriber,Twig,Voter}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if we could use %kernel.project_dir%
instead of ../..
here and elsewhere? DX and verbose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's logical, but it's longer and I kind of think it's harder. The ../ is very clear :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I thought that %kernel.project_dir%
was quite clear :), because:
- DX: I don't have to think where is the
file.yml
placed to write/read relatived paths (thinking in new configurations), - DX: Also, it account with IDE auto-completation (may be more hard for those who don't have it),
- DX: Beside, it would allows us move these files without to break its internal configuration (i.e relative paths are fragile into flexible structures),
config.yml
use%kernel.root_dir%
instead of relative paths (a big example):
framework:
router:
resource: '%kernel.root_dir%/config/routing.yml' # just 'routing.yml' work!
But I could be wrong and it's not enough of course :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer keeping the relative path too as everyone knows this syntax so a newcomer can understand it while %kernel.project_dir%
is specific to symfony.
I added some comments.
As autowiring is also enabled by default, I think we can make this move. |
app/config/services.yml
Outdated
# loads services from whatever directories you want (you can add directories!) | ||
# this creates a service per class whose id is the fully-qualified class name | ||
AppBundle\: | ||
resource: '../../src/AppBundle/{Command,Form,EventSubscriber,Twig,Voter}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the documentation, we place custom voters in a Security
subnamespace instead of using Voter
(see http://symfony.com/doc/current/security/voters.html).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the catch, updated.
See also symfony/recipes#42 for the related PR for Flex.
Other than the open question about Awesome job @GuilhemN with the comments - these are SO clear. Seriously - <3 them. |
You and @fabpot did a big part of the job so a big thank to you too ☺ I hope this will be merged soon it makes symfony much more accessible and is a great step forward imo. About |
I would indeed keep |
|
When looking at the docs, using the container as a service locator is still a big thing, so i'm totally for |
I'm also now leaning towards Of course, we should also add a comment above this new line - something like: # this means you cannot fetch services directly from the container via $container->get()
# if you need to do this, you can override this setting on individual services
public: false |
@GuilhemN this would definitely force us to do that docs-revamping right now :) - but we can do that |
@weaverryan ok I'm adding it back with your comments :) |
This PR was merged into the master branch. Discussion ---------- Store voters in Security [As caught by @xabbuh](symfony/symfony-standard#1064 (comment)), in the docs, voters are stored in `Security`, not in `Voter`. Commits ------- 6185425 Store voters in Security
Thank you @GuilhemN. |
This PR was merged into the 3.3-dev branch. Discussion ---------- Use symfony 3.3 features With [Flex coming](https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/3.3/etc/packages/app.yaml) and [the refactoring of the docs](symfony/symfony-docs#7807), I think we should push sf 3.3 di features and also begin to accustom people to sf 4.0 ideas. ping @weaverryan Commits ------- 7382e42 Use symfony 3.3 features
This PR was merged into the master branch. Discussion ---------- Add comments Related to #42 and symfony/symfony-standard#1064 Commits ------- 52c22bd Add comments
With Flex coming and the refactoring of the docs, I think we should push sf 3.3 di features and also begin to accustom people to sf 4.0 ideas.
ping @weaverryan