-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Added the explanation about addClassesToCompile() method #6405
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
Changes from 1 commit
e300ed1
b08ddc7
3b1dd7e
be5d961
7dff210
5c0f0ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,3 +125,27 @@ Using Configuration to Change the Services | |
The Extension is also the class that handles the configuration for that | ||
particular bundle (e.g. the configuration in ``app/config/config.yml``). To | ||
read more about it, see the ":doc:`/cookbook/bundles/configuration`" article. | ||
|
||
Adding Classes to Compile | ||
------------------------- | ||
|
||
In order to make applications run as fast as possible on production environment, | ||
Symfony creates a big ``classes.php`` file in the cache directory. This file | ||
aggregates the contents of the PHP classes that are used in every request, | ||
reducing the I/O operations related to those classes. | ||
|
||
Your own bundles can add classes into this file thanks to the ``addClassesToCompile()`` | ||
method. Define the classes to compile as an array of their FQCN:: | ||
|
||
$this->addClassesToCompile(array( | ||
'Appbundle\\Manager\\UserManager', | ||
'Appbundle\\Service\\Slugger', | ||
// ... | ||
)); | ||
|
||
If you add to compile all the classes commonly used by your bundle, you can | ||
expect a minor performance improvement. | ||
|
||
The main drawback of this technique is that it doesn't work for classes which | ||
contains annotations, such as controllers with ``@Route`` annotations and | ||
entities with ``@ORM`` or ``@Assert`` annotations. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. classes containing usages of You should also ad a note saying that adding a class will automatically add any parent class There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excellent warnings! Thank you. I've added them and reworded the rest a bit. |
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 would say that this paragraph doesn't add any value and can be removed.
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.
But then we explain how to do something ... but not why it's useful. But I'm going to reword it.
Uh oh!
There was an error while loading. Please reload this page.
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, the first sentence of the section already explains that we do this to improve performance.