GithubHelp home page GithubHelp logo

bake's Introduction

CakePHP

Software License Coverage Status PHPStan Code Consistency Total Downloads Latest Stable Version

CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Associative Data Mapping, Front Controller, and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.

Installing CakePHP via Composer

You can install CakePHP into your project using Composer. If you're starting a new project, we recommend using the app skeleton as a starting point. For existing applications you can run the following:

composer require cakephp/cakephp

For details on the (minimum/maximum) PHP version see version map.

Running Tests

Assuming you have PHPUnit installed system wide using one of the methods stated here, you can run the tests for CakePHP by doing the following:

  1. Copy phpunit.xml.dist to phpunit.xml.
  2. Add the relevant database credentials to your phpunit.xml if you want to run tests against a non-SQLite datasource.
  3. Run phpunit.

Some Handy Links

  • CakePHP - The rapid development PHP framework.
  • CookBook - The CakePHP user documentation; start learning here!
  • API - A reference to CakePHP's classes.
  • Awesome CakePHP - A list of featured resources around the framework.
  • Plugins - A repository of extensions to the framework.
  • The Bakery - Tips, tutorials and articles.
  • Community Center - A source for everything community related.
  • Training - Join a live session and get skilled with the framework.
  • CakeFest - Don't miss our annual CakePHP conference.
  • Cake Software Foundation - Promoting development related to CakePHP.

Get Support!

  • Slack - Join us on Slack.
  • Discord - Join us on Discord.
  • #cakephp on irc.freenode.net - Come chat with us, we have cake.
  • Forum - Official CakePHP forum.
  • GitHub Issues - Got issues? Please tell us!
  • Roadmaps - Want to contribute? Get involved!

Contributing

Security

If you’ve found a security issue in CakePHP, please use the procedure described in SECURITY.md.

bake's People

Contributors

ad7six avatar admad avatar antograssiot avatar arhell avatar bcrowe avatar ceeram avatar dakota avatar dereuromark avatar dmromanov avatar dschalla avatar geoidesic avatar josegonzalez avatar jrbasso avatar lordsimal avatar lorenzo avatar majna avatar markstory avatar mentisy avatar midorikocak avatar nateabele avatar ndm2 avatar othercorey avatar phpnut avatar predominant avatar ravage84 avatar rchavik avatar renan avatar saeideng avatar shama avatar steinkel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bake's Issues

Non-nullable belongsTo select-inputs for foreignKey not baked in form.ctp element

Edit: disabled key constraints in the SQL and fixed redundant columns (can now be simply run in the DB).

When baking (cake bake [model/controller/template] all --force) the following tables (pasted below), there is an issue on the add/edit actions of "Attachments".

The problem is that there is no select-input for page_id, although there is one for client_id.

The only difference between the two is that page_id is mandatory, whereas client_id is not (that being said, it still doesn't work if I make page_id NULLable).

Working with heavily modified bake-templates, I tried it with an unadultered installation and am seeing the same problem.

If you open (bake plugin) "Template\Bake\Element\form.ctp" and then add the following right below where the $fields collection is initialised, you can see all fields - including page_id:

    <?php
        <%  foreach ($fields as $field) {   %>

            echo $this->Form->input('<%= $field %>');

        <%  } %>
    ?>

Anyway, I can't work-out why it works further up the code since none of that code is muddling with the collection. Here's my SQL in case I'm not the only person experiencing this:

SET FOREIGN_KEY_CHECKS=0;

CREATE TABLE IF NOT EXISTS `testdb`.`attachments` (
  `id` CHAR(36) NOT NULL,
  `client_id` CHAR(36) NULL,
  `page_id` CHAR(36) NOT NULL,
  `name` VARCHAR(255) NULL,
  `path` VARCHAR(255) NULL,
  `created` DATETIME NULL,
  `modified` DATETIME NULL,
  PRIMARY KEY (`id`),
  INDEX `fk_ce_attachments_ce_pages1_idx` (`page_id` ASC),
  INDEX `fk_attachments_clients1_idx` (`client_id` ASC),
  CONSTRAINT `fk_ce_attachments_ce_pages1`
    FOREIGN KEY (`page_id`)
    REFERENCES `testdb`.`pages` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_attachments_clients1`
    FOREIGN KEY (`client_id`)
    REFERENCES `testdb`.`clients` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION);



    CREATE TABLE IF NOT EXISTS `testdb`.`clients` (
  `id` CHAR(36) NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `created` DATETIME NULL,
  `modified` DATETIME NULL,
  PRIMARY KEY (`id`));



  CREATE TABLE IF NOT EXISTS `testdb`.`pages` (
  `id` CHAR(36) NOT NULL,
  `client_id` CHAR(36) NULL,
  `name` VARCHAR(255) NOT NULL,
  `created` DATETIME NULL,
  `modified` DATETIME NULL,
  PRIMARY KEY (`id`),
  INDEX `fk_pages_clients1_idx` (`client_id` ASC),
  CONSTRAINT `fk_pages_clients1`
    FOREIGN KEY (`client_id`)
    REFERENCES `testdb`.`clients` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION);

    SET FOREIGN_KEY_CHECKS=1;

require-dev instead of require

Currently, the readme suggest require, but wouldn't one of the nice things of pluginizing be that it can now be require-dev only?
In production it is most likely not required to be included :)

Allow bake fixture all to fail without exiting

If you try to generate all fixtures with bake fixture all -f and one generation fails, for example because table cannot be detected for a model or anything else, that fail should not abort the 'all' process.

Maybe this could be happening with all other bake **** all options.

SQLServer 2012, Bake Issue when Views present.

When trying to bake a table in a SQL 2012 database that has table views it provides the following errors, this has been tested w/ deleting the view in question, which then provides an error w/ the next view down the list. Also has been tested w/ exact db with the views deleted and no bake issues

015-03-23 21:07:04 Error: [Cake\Database\Exception] Cannot describe vwAccountsSummaryView. It has 0 columns.
Stack Trace:
#0 F:\xampp\htdocs\test\app\vendor\cakephp\cakephp\src\Database\Schema\CachedCollection.php(65): Cake\Database\Schema\Collection->describe('vwAccountsSumma...', Array)
#1 F:\xampp\htdocs\test\app\vendor\cakephp\cakephp\src\ORM\Table.php(422): Cake\Database\Schema\CachedCollection->describe('vwAccountsSumma...')
#2 F:\xampp\htdocs\test\app\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(286): Cake\ORM\Table->schema()
#3 F:\xampp\htdocs\test\app\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(202): Bake\Shell\Task\ModelTask->findHasMany(Object(Cake\ORM\Table), Array)
#4 F:\xampp\htdocs\test\app\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(109): Bake\Shell\Task\ModelTask->getAssociations(Object(Cake\ORM\Table))
#5 F:\xampp\htdocs\test\app\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(95): Bake\Shell\Task\ModelTask->bake('Sites')
#6 [internal function]: Bake\Shell\Task\ModelTask->main('sites')
#7 F:\xampp\htdocs\test\app\vendor\cakephp\cakephp\src\Console\Shell.php(387): call_user_func_array(Array, Array)
#8 F:\xampp\htdocs\test\app\vendor\cakephp\cakephp\src\Console\Shell.php(382): Cake\Console\Shell->runCommand(Array, false)
#9 F:\xampp\htdocs\test\app\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(200): Cake\Console\Shell->runCommand(Array, true)
#10 F:\xampp\htdocs\test\app\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(171): Cake\Console\ShellDispatcher->_dispatch()
#11 F:\xampp\htdocs\test\app\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(122): Cake\Console\ShellDispatcher->dispatch()
#12 F:\xampp\htdocs\test\app\bin\cake.php(20): Cake\Console\ShellDispatcher::run(Array)
#13 {main}

CakePHP3.0.0 RC1: While baking the model Form Validation should applied as per the rules defined at Database end.

Hi,

if a column has defined as 'Unique', then 'validateUnique' rule should automatically applied while bake.
Please make it dynamic. It should not only applied to fixed column names 'username', 'email' etc.

Also when more than one column declared as unique , then respective validations must also be applied while baking.

For example

if I have declared collectively 'Column 1' and 'Column 2' and 'Column 3' as Unique, so respective validation should be automatically applied while bake.

Cake Bake isn't working now?

So, I understand cakephp/bake has now been made into a plugin. I have the plugin installed, but running bin/cake bake shell command produces this error:

Exception: Shell class for Bake could not be found.

If I try bin/cake bake.bake it recognizes the shell but then it throws all sorts of errors when I try to bake a model.

bash in not available by default on BSD systems

The first line of source of bin/cake show:

#!/usr/bin/env bash

For a good work on servers with FreeBSD and OpenBSD systems, I recommend changing "bash" with "sh" or create a symbolic link on system shell.

Baking plugin re-requires cake

Baking a plugin creates a composer.json file that requires cakephp again, so we got cake downloaded inside plugin's vendor folder.
(Maybe I do not understand how this works, since I'm not a composer-expert, excuse me if this issue loses your time.)

When baking (bin\cake bake all) with "--connection" parameter it throws error when it comes to the Templates (Views)

When I separated an App in two databases, if I try to bake something from a db other than the default, it is supposed to run smoothly if I use --connection CONNECTION_NAME, but it doesn't, when it reaches in the Templates (Views), it says that:

Exception: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cakeapp_db.timelines' doesn't exist in [C:\cakeapp\vendor\cakephp\cakephp\src\Database\Schema\Collection.php, line 130]

2015-03-31 18:34:07 Error: [Cake\Database\Exception] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cakeapp_db.timelines' doesn't exist
Stack Trace:
#0 C:\cakeapp\vendor\cakephp\cakephp\src\Database\Schema\Collection.php(96): Cake\Database\Schema\Collection->_reflect('Column', 'timelines', Array, Object(Cake\Database\Schema\Table))
#1 C:\cakeapp\vendor\cakephp\cakephp\src\Database\Schema\CachedCollection.php(65): Cake\Database\Schema\Collection->describe('timelines', Array)

#2 C:\cakeapp\vendor\cakephp\cakephp\src\ORM\Table.php(422): Cake\Database\Schema\CachedCollection->describe('timelines')

#3 C:\cakeapp\vendor\cakephp\bake\src\Shell\Task\TemplateTask.php(273): Cake\ORM\Table->schema()

#4 C:\cakeapp\vendor\cakephp\bake\src\Shell\Task\TemplateTask.php(139): Bake\Shell\Task\TemplateTask->_loadController()

#5 C:\cakeapp\vendor\cakephp\bake\src\Shell\BakeShell.php(243): Bake\Shell\Task\TemplateTask->main('Timelines')

#6 [internal function]: Bake\Shell\BakeShell->all('timelines')

#7 C:\cakeapp\vendor\cakephp\cakephp\src\Console\Shell.php(376): call_user_func_array(Array, Array)

#8 C:\cakeapp\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(200): Cake\Console\Shell->runCommand(Array, true)

#9 C:\cakeapp\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(171): Cake\Console\ShellDispatcher->_dispatch()

#10 C:\cakeapp\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(122): Cake\Console\ShellDispatcher->dispatch()

#11 C:\cakeapp\bin\cake.php(20): Cake\Console\ShellDispatcher::run(Array)

#12 {main}

Take for instance C:\cakeapp as the base directory, cakeapp_db as the database name from the default database, and timelines as the name of the Object that I'm trying to bake.

Restructuring

From cakephp/cakephp#5319, here's a list of things that aught to be done before a stable release:

  • Convert to a plugin
  • PSR2
  • Allow baking anything
  • Restructure to be not tasks, but event based
  • Normalize view/template terminology
  • Baking a plugin should point at a template folder (in a bake theme probably) and recursively render files
  • Rewrite/improve templates, using helper methods elements etc.

Baked files contain explicit settings that are handled by convention

After baking a UsersTable I got this snippet:

public function initialize(array $config)
{
    $this->table('users');
    $this->displayField('id');
    $this->primaryKey('id');
    $this->hasMany('Entries', [
        'foreignKey' => 'user_id'
    ]);
}

Since most of the settings are handled already by convention, this would be enough:

public function initialize(array $config)
{
    $this->displayField('username'); //changed by me
    $this->hasMany('Entries');
}

IMHO I would put emphasis on Cake's CoC pattern if the baked file would follow this pattern.

"cake bake all" should include 'empty' => true, 'default' => '' for date DEFAULT NULL fields

For a database field defined "date DEFAULT NULL" a user must currently modify the generated add.ctp and edit.ctp code to include ' array('empty' => true, 'default' => '') ' for the application to store correctly a NULL.

The current generated code is echo $this->Form->input('date_of_birth'); and the result on Submit is to store the date displayed in the 'date_of_birth' panel.
null_date_8

A test case is produced by doing a "cake bake all users" on the following table.
CREATE TABLE IF NOT EXISTS users (
id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
username varchar(254) NOT NULL,
user_email varchar(254) NOT NULL,
date_of_birth date DEFAULT NULL,
UNIQUE KEY (username),
KEY (user_email),
PRIMARY KEY (id)
);

Records with datetime break Fixture

When using records from database in FixtureTask with a datetime field it will create following code:

 public $records = [
        [
            ...
            'last_login' => Cake\I18n\Time::__set_state(array(
   'date' => '2015-02-05 12:58:15',
   'timezone_type' => 3,
   'timezone' => 'Europe/Berlin',
)),
...

Which results in

Parse error: syntax error, unexpected '(', expecting ']'

Maybe the records should be set in

public function init() {}

But the second problem is the namespace:

Fatal error: Class 'App\Test\Fixture\Cake\I18n\Time' not found in tests\Fixture\UsersFixture.php on line 69

There is missing a blackslash before Cake\I18n\Time

Issues with namespace plugins

I've tried to run migrations for my FileStorage plugin and got this message:

using migration path C:\xampp\htdocs\cake3/vendor/burzum/file-storage/config\Migrations

The plugin is in fact in /plugins/Burzum/FileStorage/ and loaded fine from there from the application itself.

Support DB prefixes when baking code

Use Case:

I'm in the situation that I finally need to apply cakephp/cakephp#4118 because of a legacy app. When I want to bake my code for the old DB that uses a prefix, how can I tell bake and cake to use that prefix? I don't want to end up with everything in my app being prefix by ho_?

Proposed solution:

The way I see it for this situation is this: Let's modify bake to support --db-prefix. --db-prefix will make bake aware to use the prefix, for example my ho_. But bake won't use it in the generated code then. Bake will create the table() call with the prefix then but ignore it everywhere else. Sounds fine?

Wrong isUnique() syntax

After baking a Table class from a DB table with a UNIQUE index I got this snippet in the table class:

public function buildRules(RulesChecker $rules)
{
    $rules->add($rules->isUnique('username'));
    return $rules;
}

This produces errors as the first parameter for bake must be an array. The correct syntax would be

$rules->add($rules->isUnique(['username']));

Add _serialize to actions

Building we APIs is becoming the norm nowadays, we should adapt to this trend by adding $this->set('_serialize', $variables) for the important stuff on each action template.

Bake Table with same name like existent task

When trying to generate skeleton for a table which has the same name as a controller, the table name is ignored:

% bin/cake bake all:
> Welcome to CakePHP v3.0.0-beta3 Console
>---------------------------------------------------------------
>App : src
>Path: /var/www/bake_plugin/src/
>---------------------------------------------------------------
>Bake All
>---------------------------------------------------------------
>Possible model names based on your database:
>- all
>- news
>Run `cake bake all [name]` to generate skeleton files.

 % bin/cake bake all all:
 % bin/cake bake all project

Those lead to the same output, since the table name "all" or "project" is dropped.

I expect that ConsoleOptionParser/parse() (Line 544) is responsible for this behaviour.

Unsure if it works as intended or if its a bug.

Advice needed - additional common actions for bake

What is better way to bake an additional common actions (like enable, moveup, movedown and etc.) additionally to index, view, add, edit, delete? Is there a trick that I have missed or proper way will be modify CAKE/vendor/cakephp/bake/src/Shell/Task/ControllerTask.php by making branch?

bin/cake not listing bake shell

Executing composer require --dev cakephp/bake results in bake being cloned to /vendor/cakephp/bake, but bin/cake does not list the Bake-Shell. Probably this is the result of no Plugin folder being created in /plugins?

How to bake using templates?

Where do templates go now that this has been moved into a plugin? Before we could put custom templates in src/Template/Bake/ but the plugin doesn't appear to read these. I tried putting my template in plugins/Bake/src/Template/ but this didn't seem right, nor did it work.

Is this even at a stage where I should be using it?

Baking tables generates aliases

I had an issue with some assocs and talked with Jose while talking with him he mentioned that I should not use 'alias' any more but I never put it it in there, it was baked.

We should remove the baked "alias" then. Here is what was baked:

    public function initialize(array $config) {
        $this->table('contacts');
        $this->displayField('title');
        $this->primaryKey('id');
        $this->addBehavior('Timestamp');
        $this->belongsTo('CreatedByUsers', [
            'alias' => 'CreatedByUsers',
            'foreignKey' => 'created_by_user_id'
        ]);
        $this->belongsTo('ModifiedByUsers', [
            'alias' => 'ModifiedByUsers',
            'foreignKey' => 'modified_by_user_id'
        ]);
        $this->belongsTo('ContactInfos', [
            'alias' => 'ContactInfos',
            'foreignKey' => 'contact_info_id'
        ]);
        $this->belongsTo('PrivateAddres', [
            'alias' => 'PrivateAddres',
            'foreignKey' => 'private_address_id'
        ]);
        $this->belongsTo('BusinessAddres', [
            'alias' => 'BusinessAddres',
            'foreignKey' => 'business_address_id'
        ]);
        $this->belongsToMany('Accounts', [
            'alias' => 'Accounts',
            'foreignKey' => 'contact_id',
            'targetForeignKey' => 'account_id',
            'joinTable' => 'accounts_contacts'
        ]);
    }

the baking of a custom action is not working

It seems, that the backing custom action is not working:
bin/cake bake template roles reset --plugin Guard --theme Tools --force
but backing CRUD actions works well
bin/cake bake template roles view --plugin Guard --theme Tools --force

The action reset in a controller RolesController.php in plugin Guard (additionally to CRUD and other) exists.
The template for the action APP/plugins/Tools/src/Template/Bake/Template/reset.ctp exists too.

I think something wrong happens around APP/vendor/cakephp/bake/src/View/BakeView.php

Cake 3.0 bake index template limits to first 7 fields

It took me hours to figure out why the eighth field of my users table wasn't showing up in index views.
Template/index.ctp creates a Collection of fields, but chains on ->take(7) at the end to limit the list, presumably so index tables don't get too wide for screens. Wouldn't it be better to show them all and offer an optional limit value, or better yet specify a list of fields to show/omit? In 2.x you just went into the baked view and deleted any <th>'s and <td>'s you didn't want. Now you have to pop the hood on the form template and discover and remove the hard-coded (7). Good luck to newbies!
Either way, arbitrarily, and secretly, lopping off everything after the first 7 fields is not the friendliest Bake feature.

Baking plugin models can clash with existing app models

The model task will use the model name without the plugin name to retrieve the table object, see

This leads to possible existing app table classes with same name being used, which could then in turn cause various problems, like for example the wrong accessible fields being generated as associations are not going to be applied, or problems with finding associations or counter cache fields as the schema could possible have been modified.

Baking views for models omits self associations

  1. Create a model with a self-association. For example, links between two users, or a tree structure.
  2. Bake views for this model with a self-association. The parent/child associations will be omitted from the views.

It looks like this issue was introduced in #4440 when navigation links were cleaned up. However, I think the related entity blocks should still be included in the view page. Perhaps we need another flag in the association data that indicates whether or not the association should be in the navigation as omitting self associations entirely is not great.

problem with hierarchy of namespace in plugin name

when use problem with hierarchy of namespace in plugin name, baker generating incorrect any class of need used namespace
for example: plugin name is Rita/Users, baker generate entity class Similar this :

<?php
/* /Plugin/Rita/Users/src/Model/Entity/User.php */
namespace Rita/Users\Model\Entity;

use Cake\ORM\Entity;

3.1: PHP Fatal error: Class 'Cake\Mailer\Email' not found in /path/to/my-app/config/bootstrap.php on line 138

I am not sure if this is the right place for this but, I installed app using command:

composer create-project --prefer-source cakephp/app my-app 3.1.x-dev

When I try to run cake bake on app root directory;

bin/cake bake all

happens this:

$ bin/cake bake all
PHP Fatal error:  Class 'Cake\Mailer\Email' not found in /path/to/my-app/config/bootstrap.php on line 138
PHP Stack trace:
PHP   1. {main}() /path/to/my-app/bin/cake.php:0
PHP   2. include() /path/to/my-app/bin/cake.php:31

Fatal error: Class 'Cake\Mailer\Email' not found in /path/to/my-app/config/bootstrap.php on line 138

Call Stack:
    0.0004     229728   1. {main}() /path/to/my-app/bin/cake.php:0
    0.0025     269088   2. include('/path/to/my-app/config/bootstrap.php') /path/to/my-app/bin/cake.php:31

Is this a bug? Or did I make an error? Thanks...

CakePHP 3.0.0RC2 when baking to a plugin, bake controller doesn't find model's associations.

To reproduce:
bake a plugin:

bin\cake bake plugin Pluggy

bake a model in the plugin, where the table has belongsTo or hasMany associations (ie Roles):

bin\cake bake model --plugin Pluggy --no-test --force roles
bin\cake bake model --plugin Pluggy --no-test --force users

now bake the UsersController:

bin\cake bake controller --plugin Pluggy --no-test --force users

Check the UsersController::add() method and you won't see the find for the associated belongsTo table:

$roles = $this->Users->Roles->find('list',...etc)     <--- *this is missing*

so it doesn't set(compact('roles'.. for the view.

If you take out the --plugin Pluggy, it will work correctly, creating the controller in src/controller, of course, not in plugins/Pluggy/src/controller.

I dug around a little in the add.ctp element template used by the controller template and inserted some debug logging after the $associations array is populated using Bake->aliasExtractor (around line 36), and it shows the array empty when baking to a plugin, filled if not. I didn't dig into the source for this aliasExtractor, but somewhere I expect a $plugin variable got left out.
DJ

Automatically add @property annotations to Tables

It would be nice if baked Table classes would have @property annotations for the associations they have, like this:

/**
 * Entries Model
 *
 * @property \Cake\ORM\Association Users
 * @property \Cake\ORM\Association Jobs
 */

(The code above was in fact added by a PhpStorm inspection and is really usefull)

AFAIK this is already done for Controller so it should not be so hard to implement.

Decouple the migration actions from the shell

There seems to be no simple way that would allow me to run migrations via code?

For example, I have a plugin installer and want to run the migrations not using the shell but inside my plugin managers code. I've spent some time on trying to figure out how to do it but there seems to be a lot code around Phinx acting as a wrapper for setting up the connection between Cake and Phinx.

It would be nice if the migrations plugin would be more abstract than tight coupled with the shell. For example allow me to do something like this:

$migrations = new Migrations('connectionName');
$migrations->migrate(); // App migrations
$migrations->migrate('PluginName'); // Plugin migrations
$migrations->setConnection('otherConnection');

Right now the Phinx code is totally interwoven with the Shell code.

How can I bake a single controllers templates?

What I did

$ bin/cake bake template all Users index

What I expected
I would expect that the Users index template would be generated

What actually happened
The shell generated templates for all my controllers.

How I tried to check myself
Using

$ bin/cake bake template -h

Shows that there is only the all subcommand, and the arguments show as allowing a controller and action, yet these arguments seem to be ignored.

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.