Skip to content

[DI] Documenting Abstract Bundle and Extension #16801

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 9 commits into from
May 27, 2022

Conversation

yceruto
Copy link
Member

@yceruto yceruto commented May 12, 2022

Fixes #16669
PR symfony/symfony#43701

ping @Nyholm @wouterj as you were interested in this feature/doc. Any suggestion to improve the wording is more than welcome!


I also updated other places to be aligned with the best practices doc.
I didn't remove the current convention to create bundles/extensions/configurations because they are still valid until 6.4 becomes the last LTS available. However, it's ok for apps using AbstractExtension.

@carsonbot carsonbot added this to the 6.1 milestone May 12, 2022
@yceruto yceruto changed the title Documenting Abstract Bundle and Extension [HttpKernel][DI] Documenting Abstract Bundle and Extension May 12, 2022
@yceruto
Copy link
Member Author

yceruto commented May 12, 2022

About CI jobs, Is there any way to know which code block is failing? and how these failures can be fixed?:

bundles/prepend_extension.rst ✘
  174: Please reorder the use statements alphabetically
   ->  and defining the :method:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle::prependExtension` method::

bundles/extension.rst ✘
  160: Please reorder the use statements alphabetically
   ->  and defining the :method:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle::loadExtension` method::

Warning: ] Found "2" invalid files!                                             

Error: Please reorder the use statements alphabetically
Error: Please reorder the use statements alphabetically

Copy link
Contributor

@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.

Thanks for this feature and its docs :)

@wouterj wouterj linked an issue May 16, 2022 that may be closed by this pull request
nicolas-grekas added a commit to symfony/symfony that referenced this pull request May 21, 2022
…le` is used (yceruto)

This PR was merged into the 6.1 branch.

Discussion
----------

[HttpKernel] New bundle path convention when `AbstractBundle` is used

| Q             | A
| ------------- | ---
| Branch?       | 6.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | symfony/symfony-docs#16801

Addressing this comment symfony/symfony-docs#16801 (comment)

Since Symfony 6.1 when any bundle starts using the new `AbstractBundle` and the bundle is placed in the `src/` directory we automatically update this path to the parent directory, so we don't have to do it manually to use [the modern bundle directory structure](https://symfony.com/doc/current/bundles/best_practices.html#directory-structure).

As far as I can see, there is no BC break on this proposal as this is a new class introduced in 6.1 and you have to update your code to make this happen. I will add a note about this subject in the doc too.

Commits
-------

1193ed2 New bundle path convention when AbstractBundle is used
@yceruto yceruto force-pushed the simple_bundle_extension branch 2 times, most recently from 75d9b9b to d0cba72 Compare May 21, 2022 14:17
Copy link
Member

@wouterj wouterj left a comment

Choose a reason for hiding this comment

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

Hi @yceruto! Thanks again for all these amazing docs.

I've pushed a commit to your branch doing a bit more radical rewrite. Please have a look at the changes. This PR is ready to merge if you approve them imho :)
As I said on Slack, we might want to rewrite all bundle docs in the future, to swap the order (first AbstractBundle, then Extension+Configuration). Yet, the current changes are perfect for the 6.1 release already I think.

@@ -205,6 +212,39 @@ Before continuing, run this command to add support for the new dependencies:

$ composer require symfony/yaml symfony/twig-bundle symfony/web-profiler-bundle doctrine/annotations

Next, create a new extension class that defines your app configuration and
Copy link
Member

Choose a reason for hiding this comment

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

To be honest, I'm not really sure if this is a good place to document AbstractExtension. What is its use-case when using MicroKernelTrait?

If we want to keep it, I would suggest moving the changes in this document to a new section below this one. Currently, I'm afraid the doc can make people think that they must use the app extension (or build() method) when using the micro kernel.

Copy link
Member Author

@yceruto yceruto May 22, 2022

Choose a reason for hiding this comment

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

To be honest, I'm not really sure if this is a good place to document AbstractExtension. What is its use-case when using MicroKernelTrait?

Apps on bundle-less approach still need to define custom configuration, and it's only possible through a new extension, even if the kernel class can implement the ExtensionInterface + Configuration it's better now by creating a new extension class and extending from AbstractExtension.

If we want to keep it, I would suggest moving the changes in this document to a new section below this one. Currently, I'm afraid the doc can make people think that they must use the app extension (or build() method) when using the micro kernel.

I think you're right, it could be better in a new section with the proper explanation.

@carsonbot carsonbot changed the title [HttpKernel][DI] Documenting Abstract Bundle and Extension [DI] Documenting Abstract Bundle and Extension May 22, 2022
@yceruto
Copy link
Member Author

yceruto commented May 22, 2022

@wouterj thanks a lot for your improvements, it looks better now 🙏

@javiereguiluz javiereguiluz merged commit 6be632e into symfony:6.1 May 27, 2022
@javiereguiluz
Copy link
Member

This was finally merged 🎉

Yonel, thanks again for such a nice contribution! Thanks to reviewers too!

@yceruto yceruto deleted the simple_bundle_extension branch May 27, 2022 14:49
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.

[HttpKernel] Simplifying Bundle/Extension config definition
6 participants