-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Added the explanation about addClassesToCompile() method #6405
Conversation
|
||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
classes containing usages of __DIR__
and __FILE__
cannot be added either (as loading them from classes.php would change these paths).
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 comment
The 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.
* Classes contain annotations, such as controllers with ``@Route`` annotations | ||
and entities with ``@ORM`` or ``@Assert`` annotations; | ||
* Classes use the ``__DIR__`` and ``__FILE__`` constants, because their values | ||
will change when loading these classes from the ``classes.php`` file. |
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 personally would find it interesting to know why it doesn't work for annotations. One of the reasons is the file location retrieved from reflection. Is this something you could add to the documentation?
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've just added your proposal. Thanks!
This PR is read to be merged too. Thanks! |
After adding to compile all the classes commonly used by your bundle, you can | ||
expect a minor performance improvement. | ||
|
||
Beware that this technique can't be used in some cases: |
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 put this one and the lines below in a caution
block to emphasize it a bit more.
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.
Instead I've added bold text to emphasize. Personally I don't like to define so many admonitions. It "breaks" the reading flow.
I've simplified everything to explain things better. |
👍 |
1 similar comment
👍 |
Thanks Javier, looks great! |
This fixes #4492.