[make:crud|voter] generate classes with final keyword #1539
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.