Skip to content

[AssetMapper][FrameworkBundle] Do not require http_client service #57073

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

Merged
merged 1 commit into from
May 25, 2024

Conversation

ruudk
Copy link
Contributor

@ruudk ruudk commented May 23, 2024

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues
License MIT

This makes it possible to use AssetMapper with http_client disabled on the framework.

It will automatically instantiate the required HttpClient.

Example:

$configurator->extension(
    'framework',
    [
        'http_client' => [
            'enabled' => false,
        ],
        'asset_mapper' => [
            'paths' => [
                'assets/',
            ],
        ],
    ]
);

This fixes the following problems:

The service "asset_mapper.importmap.resolver" has a dependency on a non-existent service "http_client".

The service "asset_mapper.importmap.auditor" has a dependency on a non-existent service "http_client".

The service "asset_mapper.importmap.update_checker" has a dependency on a non-existent service "http_client".

@carsonbot
Copy link

Hey!

Thanks for your PR. You are targeting branch "7.2" but it seems your PR description refers to branch "6.4".
Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

@ruudk ruudk changed the title Do not require http_client service [Framework][AssetMapper] Do not require http_client service May 23, 2024
@ruudk ruudk changed the base branch from 7.2 to 6.4 May 23, 2024 11:25
@ruudk
Copy link
Contributor Author

ruudk commented May 23, 2024

@carsonbot done

@carsonbot carsonbot changed the title [Framework][AssetMapper] Do not require http_client service [AssetMapper][FrameworkBundle] [Framework] Do not require http_client service May 23, 2024
@xabbuh xabbuh modified the milestones: 7.2, 6.4 May 23, 2024
@ruudk ruudk changed the title [AssetMapper][FrameworkBundle] [Framework] Do not require http_client service [AssetMapper][FrameworkBundle] Do not require http_client service May 23, 2024
@nicolas-grekas
Copy link
Member

Ah: why do you consider this as a bugfix? To me it's for 7.2

@ruudk
Copy link
Contributor Author

ruudk commented May 23, 2024

To me it's a bug and not a feature? It's not working without the service defined.

) {
$this->httpClient = $httpClient ?? HttpClient::create();
Copy link
Member

Choose a reason for hiding this comment

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

The changes here do not qualify as a bugfix to me. I think for 6.4 we should remove the asset mapper services instead that require the http_client service.

Copy link
Member

Choose a reason for hiding this comment

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

here is a PR implementing my suggestion: #57219

Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

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

As explained, new feature for 7.2.

@fabpot fabpot modified the milestones: 6.4, 7.2 May 25, 2024
This makes it possible to use AssetMapper with `http_client` disabled on the framework.

Example:
```php
$configurator->extension(
    'framework',
    [
        'http_client' => [
            'enabled' => false,
        ],
        'asset_mapper' => [
            'paths' => [
                'assets/',
            ],
        ],
    ]
);
```
@fabpot fabpot changed the base branch from 6.4 to 7.2 May 25, 2024 14:47
@fabpot fabpot force-pushed the do-not-require-http-client-service branch from ce00298 to b5e39ec Compare May 25, 2024 14:47
@fabpot
Copy link
Member

fabpot commented May 25, 2024

Thank you @ruudk.

@fabpot fabpot merged commit 66b57c9 into symfony:7.2 May 25, 2024
7 of 9 checks passed
@ruudk ruudk deleted the do-not-require-http-client-service branch May 25, 2024 17:03
nicolas-grekas added a commit to nicolas-grekas/symfony that referenced this pull request Jun 26, 2024
…equire `http_client` service (ruudk)"

This reverts commit 66b57c9, reversing
changes made to 3bdbb07.
nicolas-grekas added a commit that referenced this pull request Jun 28, 2024
…se asset-mapper while http-client is disabled (nicolas-grekas)

This PR was merged into the 6.4 branch.

Discussion
----------

[FrameworkBundle] Throw runtime exception when trying to use asset-mapper while http-client is disabled

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

Replaces #57219 and #57073

Commits
-------

df133a9 [FrameworkBundle] Throw runtime exception when trying to use asset-mapper while http-client is disabled
@fabpot fabpot mentioned this pull request Oct 27, 2024
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.

7 participants