Git Product home page Git Product logo

cakephp-generation-gap-pattern-model-baker's Introduction

GenerationGapModelBaker plugin for CakePHP4

This is a plugin that uses the Generation gap pattern to realize bakeable Model operations.

The automatic generation tool creates only superclasses. And humans do not modify it. Humans create subclasses of that class. The auto-generator does not manipulate those subclasses.

Generation gap Pattern Reference (Japanese)

http://www.hyuki.com/dp/dpinfo.html#GenerationGap

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require --dev lancers/cakephp-generation-gap-pattern-model-baker

To install with composer.json , add the following

    "require-dev": {
        "lancers/cakephp-generation-gap-pattern-model-baker": "1.*",
    }

Usage

1. Add to bootstrap_cli.php

Add config to load custom template.

Configure::write('Bake.theme', 'GenerationGapModelBaker');

2. Add to Application.php

This is not necessary in the runtime environment, so addPlugin at debug time.

if (Configure::read('debug')) {
    $this->addPlugin('GenerationGapModelBaker');    // add line
    $this->addPlugin('DebugKit');
}

3. Run bake command to create Models

bin/cake bake extended_model table_name

In the case of the examples table, a Model file will be created as follows.

$ bin/cake bake extended_model examples 
One moment while associations are detected.

Baking table class for Examples...

Creating file /var/www/lancers_admin/src/Model/Baked/Table/ExamplesTable.php
Wrote `/var/www/lancers_admin/src/Model/Baked/Table/ExamplesTable.php`

Baking entity class for Example...

Creating file /var/www/lancers_admin/src/Model/Baked/Entity/Example.php
Wrote `/var/www/lancers_admin/src/Model/Baked/Entity/Example.php`

Baking entended table class for Examples...

Creating file /var/www/lancers_admin/src/Model/Table/ExamplesTable.php
Wrote `/var/www/lancers_admin/src/Model/Table/ExamplesTable.php`

Baking entended entity class for Example...

Creating file /var/www/lancers_admin/src/Model/Entity/Example.php
Wrote `/var/www/lancers_admin/src/Model/Entity/Example.php`

Baking test fixture for Examples...

Creating file /var/www/lancers_admin/tests/Fixture/ExamplesFixture.php
Wrote `/var/www/lancers_admin/tests/Fixture/ExamplesFixture.php`
Bake is detecting possible fixtures...

Baking test case for App\Model\Table\ExamplesTable ...

Creating file /var/www/lancers_admin/tests/TestCase/Model/Table/ExamplesTableTest.php
Wrote `/var/www/lancers_admin/tests/TestCase/Model/Table/ExamplesTableTest.php`
Done

cakephp-generation-gap-pattern-model-baker's People

Contributors

mamy1326 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.