-
-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[make:crud|voter] generate classes with final keyword #1539
Conversation
Thanks Jesse |
Hmm. So I don't think we can Like the failed tests for this PR, wouldn't we trigger logic exceptions everywhere in userland code similar to:
if all the generated entities were I think the only way we can implement the If I'm missing something obvious - please let me know.. Thoughts @symfony/mergers ? |
37bcfbd
to
e9ee254
Compare
8d97b3b
to
ee87da1
Compare
522869b
to
26d91de
Compare
26d91de
to
2d0e7d0
Compare
2d0e7d0
to
7ec0685
Compare
7ec0685
to
988f765
Compare
introduces 2 new configuration values:
generate_final_classes
: Defaults totrue
- When true, all non-entity classes generated by MakerBundle will be final.generate_final_entities
: Defaults tofalse
- When true, all entity classes generated by MakerBundle will be final.introduces an internal
ClassData
object that represents all of the meta data needed to generate a class from a template. It combines parts ofClassNameDetails
&UseStatementGenerator, while adding logic to generate a class declaration conditionally including the
finalkeyword &
extends` class.ClassData
is configured byTemplateComponentGenerator
to handleroot_namespace
,generate_final_classes
, &generate_final_entities
if passed as a templateclass_data
variable toGenerator::createClass()
. The idea being we don't have to modify the constructor for the "non-internal"Generator::class
reduces the complexity of our
.tpl.php
templates. TheClassData
object is accessible from within the templates (Crud & Voter for now).$class_data->getClassDeclaration()
generatesfinal class SomeClass extends XyzClass
To keep the PR's "reviewable" this PR only adds the new functionality for
make:crud
&make:voter
. To be implemented in additional makers in subsequent PR's.fix test fixtures to use
final
update this description to include all of the proposed changes
fixes #1536
I think instead of one massive PR, we will merge this PR first to include
make:voter
&make:crud
-> create subsequent PR's for makers that touch entities (1 pr) and the rest of the makers (1 pr). I say this because this PR is actually adding a handful of new features (mostly internal) in order to generatefinal
classes.