-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Allow naming plugin classes matching the plugin name. #16374
Conversation
This avoids having numerous classes named "Plugin" in your app.
@@ -17,6 +17,6 @@ | |||
|
|||
use Cake\Core\BasePlugin; | |||
|
|||
class Plugin extends BasePlugin | |||
class TestPluginThreePlugin extends BasePlugin |
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.
oof, that name.
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.
You know what they say about naming things in programming :)
You mean "suffix", yes? |
{ | ||
public function bootstrap(PluginApplicationInterface $app): void | ||
{ | ||
Configure::write('ParentPlugin.bootstrap', true); | ||
Configure::write('Named.bootstrap', true); |
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 don't see any changes for this name lookup. Is it dependent on anything?
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.
See the BaseApplicationTest.
Yes, typo :) |
For reference Symfony bundle classes are names similarly. For e.g. the "TwigBundle" has the class |
It would be good to update the docs too. |
This avoids having numerous classes named "Plugin" in your app. You can now name the class the same as the plugin name with a "Plugin" suffix. For e.g.
ADmad\I18n\I18nPlugin
instead ofADmad\I18n\Plugin
.