A CakePHP 3.x bake generation theme that matches Loadsys' code sniffer standards. It's designed to dovetail with our CakePHP App Skeleton.
- CakePHP 3.x
$ composer require loadsys/cakephp-loadsys-theme:~1.0
This plugin includes Bake in its own composer dependencies, so when using this theme you do not need to include it separately in your projects.
- Add this plugin to your application by adding this line to your bootstrap.php
CakePlugin::load('LoadsysTheme', ['bootstrap' => true, 'routes' => false]);
- To use when baking, use the CLI option
--theme LoadsysTheme
like so
$ ./vendor/bin/cake bake all --theme LoadsysTheme name-of-thing
Loadsys has chosen to ignore the requirement of PSR-2 to use spaces for indenting. We've found tabs to be more convenient, and we're keeping them. If you disagree, that's fine -- this plugin isn't going to be much use to you.
We're also sticking to K&R style braces for everything.
public function foo() {
echo 'hi';
}
The core team believes that using AppController and AppView continues to provide significant value to the framework (thread), but does not feel that hold true for AppTable (or AppEntity). We disagree.
Table
classes baked by this plugin extend from a parent [App]Table class (conveniently still called Table
thanks to PHP namespaces.) The Table class it depends upon is provided from the Loadsys CakePHP Skeleton. As in Cake 2, it's safe to completely ignore this file, provided it is at least present in your app. If you need a Table class baked in which you wish to change this, you must either bake using Cake's default theme or modify the classes after baking them.
Additionally, because our table.ctp
template assumes that our Skeleton's base Table class will be used, we suppress certain parts of the table baking process. The [App]Table class sets up the primary key, adds the Timestamp and CreatorModifier behaviors, defines two default associations to Creators and Modifiers in the Users table, and suppresses validation for the 5 related fields. It would therefore be redundant and defeat the purpose of the based Table class to bake tables that repeated these steps, so they are skipped.
This project has adopted the Contributor Covenant as its code of conduct. All contributors are expected to adhere to this code. Translations are available.
Please use GitHub Isuses for listing any known defects or issues.
When developing this plugin, please fork and issue a PR for any new development.
vendor/bin/phpunit --coverage-html=tmp/coverage/
vendor/bin/phpcs