Skip to content
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

Better explain the mandatory/convention location of some elements #6616

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions cookbook/bundles/best_practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,23 @@ them under the ``cache/`` or ``log/`` directory of the host application. Tools
can generate files in the bundle directory structure, but only if the generated
files are going to be part of the repository.

The following classes and files have specific emplacements:

=============================== =============================
Type Directory
=============================== =============================
Commands ``Command/``
Controllers ``Controller/``
Service Container Extensions ``DependencyInjection/``
Event Listeners ``EventListener/``
Model classes [1] ``Model/``
Configuration ``Resources/config/``
Web Resources (CSS, JS, images) ``Resources/public/``
Translation files ``Resources/translations/``
Templates ``Resources/views/``
Unit and Functional Tests ``Tests/``
=============================== =============================
The following classes and files have specific emplacements (some are mandatory
and others are just conventions followed by most developers):

=============================== ============================= ================
Type Directory Mandatory?
=============================== ============================= ================
Commands ``Command/`` Yes
Copy link
Member

Choose a reason for hiding this comment

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

technically, not fully (mandatory only for auto-registration, but we have tag-based registration since 2.4)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that applies to about 99% of the mandatory elements in this table. That's why I started to dislike documenting these. But I think it'll help if we document the default way for beginners.

Copy link
Member

Choose a reason for hiding this comment

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

I agree (see my comment above).

Copy link
Member Author

Choose a reason for hiding this comment

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

What if we revert this change and add a short cookbook article explaining how to override all of these locations?

Copy link
Member

Choose a reason for hiding this comment

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

Are we sure it's worth it? How often do you need to do that? And if you have the need, won't you probably experienced enough to figure that out yourself?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it's that easy. For example: how do you put the translations in <your-bundle>/translations/* instead of <your-bundle>/Resources/translations/ or the templates in <your-bundle>/templates/* instead of <your-bundle>/Resources/views/* ?

Controllers ``Controller/`` No
Service Container Extensions ``DependencyInjection/`` Yes
Event Listeners ``EventListener/`` No
Model classes [1] ``Model/`` No
Configuration ``Resources/config/`` No
Web Resources (CSS, JS, images) ``Resources/public/`` Yes
Translation files ``Resources/translations/`` Yes
Templates ``Resources/views/`` Yes
Copy link
Member

@xabbuh xabbuh May 29, 2016

Choose a reason for hiding this comment

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

and here

Unit and Functional Tests ``Tests/`` No
=============================== ============================= ================

[1] See :doc:`/cookbook/doctrine/mapping_model_classes` for how to handle the
mapping with a compiler pass.
Expand Down