Skip to content
New issue

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

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

Already on GitHub? # to your account

[DI] resolves sf services in config #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ottaviano
Copy link

@ottaviano ottaviano commented Nov 20, 2021

Hello 👋
I copied this piece of code from v1.0.0 of the bundle to keep the possibility of using Sf service in the bundle config:

AutoFormat.Custom: 
  - '@my_custom_service'

Copy link
Collaborator

@HeahDude HeahDude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ottaviano :) Thank you for this PR and sorry for the delay. Are you still interested in finishing this?

@@ -21,6 +22,7 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('html_purifier.xml');

$configs = $this->processConfiguration(new Configuration(), $configs);
$configs = array_map([$this, 'resolveServices'], $configs);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$configs = array_map([$this, 'resolveServices'], $configs);
$configs = $container->resolveServices($configs);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @HeahDude, the test no longer passes with this solution, @App\MyService is not replaced by Reference instance

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright then we need to be more careful with possible conflict and allow escaping @ when it's expected as legit character.
I propose to use a regex instead and allow escaping by doubling @@ as it is done in yaml config in Symfony.
We should also add a note about it in the docs (in the README).

@HeahDude HeahDude added this to the 4.1 milestone Apr 22, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants