Giter VIP home page Giter VIP logo

app's Introduction

CakePHP Application Skeleton

Build Status Total Downloads PHPStan

A skeleton for creating applications with CakePHP 5.x.

The framework source code can be found here: cakephp/cakephp.

Installation

  1. Download Composer or update composer self-update.
  2. Run php composer.phar create-project --prefer-dist cakephp/app [app_name].

If Composer is installed globally, run

composer create-project --prefer-dist cakephp/app

In case you want to use a custom app dir name (e.g. /myapp/):

composer create-project --prefer-dist cakephp/app myapp

You can now either use your machine's webserver to view the default home page, or start up the built-in webserver with:

bin/cake server -p 8765

Then visit http://localhost:8765 to see the welcome page.

Update

Since this skeleton is a starting point for your application and various files would have been modified as per your needs, there isn't a way to provide automated upgrades, so you have to do any updates manually.

Configuration

Read and edit the environment specific config/app_local.php and set up the 'Datasources' and any other configuration relevant for your application. Other environment agnostic settings can be changed in config/app.php.

Layout

The app skeleton uses Milligram (v1.3) minimalist CSS framework by default. You can, however, replace it with any other library or custom styles.

app's People

Contributors

ad7six avatar admad avatar andretefras avatar antograssiot avatar bcrowe avatar cake17 avatar ceeram avatar dependabot[bot] avatar dereuromark avatar garas avatar inoas avatar ionas avatar jadb avatar jeremyharris avatar jippi avatar josegonzalez avatar jperras avatar jrbasso avatar lordsimal avatar lorenzo avatar markstory avatar nateabele avatar othercorey avatar phpnut avatar predominant avatar ravage84 avatar rchavik avatar renan avatar saeideng 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

app's Issues

ConsoleShell: adding a -q / --quiet option?

Doing something like this is currently extremely difficult:

$ echo 'use Cake\Datasource\ConnectionManager; ConnectionManager::config("default");'
   | bin/cake Console

Welcome to CakePHP v3.0.7 Console
---------------------------------------------------------------
App : src
Path: /var/www/src/
---------------------------------------------------------------
You can exit with `CTRL-C` or `exit`

Psy Shell v0.4.4 (PHP 5.6.10-1+deb.sury.org~precise+1 โ€” cli) by Justin Hileman
=> [
       "className"        => "Cake\\Database\\Connection",
       "driver"           => "Cake\\Database\\Driver\\Mysql",
       "persistent"       => false,
       "host"             => "localhost",
       "username"         => "vagrant",
       "password"         => "vagrant",
       "database"         => "vagrant",
       "encoding"         => "utf8",
       "timezone"         => "UTC",
       "cacheMetadata"    => true,
       "quoteIdentifiers" => false,
       "name"             => "default"
   ]

Exit:  Ctrl+D

All of that banner stuff, the => and the Exit: Ctrl-D are all seriously in the way if I wanted to consume this output from somewhere else. What I'd really want out of a call like that is this:

$ echo 'use Cake\Datasource\ConnectionManager; var_export(ConnectionManager::config("default"));'
   | bin/cake Console --quiet
array (
  'className' => 'Cake\\Database\\Connection',
  'driver' => 'Cake\\Database\\Driver\\Mysql',
  'persistent' => false,
  'host' => 'localhost',
  'username' => 'vagrant',
  'password' => 'vagrant',
  'database' => 'vagrant',
  'encoding' => 'utf8',
  'timezone' => 'UTC',
  'cacheMetadata' => true,
  'quoteIdentifiers' => false,
  'name' => 'default',
)

Suppressing the banner is easy, but I have not investigated what it might take to suppress Boris's REPL output and only print what the provided commands might produce.

I could even see a case being made for --quiet being enabled by default when accepting redirected input like this.

Add a travis config file

While this repo doesn't have unit tests to run we can still do a few things:

  • Check syntax/verify the composer.json
  • Run the cakephp code sniffer rules.

Error: The "Html" alias has already been loaded with the following

When I use my baked views I get this error message since this morning. Latest cakephp 3 beta, composer update just a few minutes ago.

Error: The "Html" alias has already been loaded with the following config: array ( 'templates' => array ( 'meta' => '<meta{{attrs}}/>', 'metalink' => '<link href="{{url}}"{{attrs}}/>', 'link' => '<a href="{{url}}"{{attrs}}>{{content}}</a>', 'mailto' => '<a href="mailto:{{url}}"{{attrs}}>{{content}}</a>', 'image' => '<img src="{{url}}"{{attrs}}/>', 'tableheader' => '<th{{attrs}}>{{content}}</th>', 'tableheaderrow' => '<tr{{attrs}}>{{content}}</tr>', 'tablecell' => '<td{{attrs}}>{{content}}</td>', 'tablerow' => '<tr{{attrs}}>{{content}}</tr>', 'block' => '<div{{attrs}}>{{content}}</div>', 'blockstart' => '<div{{attrs}}>', 'blockend' => '</div>', 'tag' => '<{{tag}}{{attrs}}>{{content}}</{{tag}}>', 'tagstart' => '<{{tag}}{{attrs}}>', 'tagend' => '</{{tag}}>', 'tagselfclosing' => '<{{tag}}{{attrs}}/>', 'para' => '<p{{attrs}}>{{content}}</p>', 'parastart' => '<p{{attrs}}>', 'css' => '<link rel="{{rel}}" href="{{url}}"{{attrs}}/>', 'style' => '<style{{attrs}}>{{content}}</style>', 'charset' => '<meta http-equiv="Content-Type" content="text/html; charset={{charset}}"/>', 'ul' => '<ul{{attrs}}>{{content}}</ul>', 'ol' => '<ol{{attrs}}>{{content}}</ol>', 'li' => '<li{{attrs}}>{{content}}</li>', 'javascriptblock' => '<script{{attrs}}>{{content}}</script>', 'javascriptstart' => '<script>', 'javascriptlink' => '<script src="{{url}}"{{attrs}}></script>', 'javascriptend' => '</script>', ), ) which differs from array ( )

/home/vps42/public_html/vendor/cakephp/cakephp/src/Core/ObjectRegistry.php in line 123

Stack Trace
CORE/src/Core/ObjectRegistry.php line 72 โ†’ Cake\Core\ObjectRegistry->_checkDuplicate(string, array)
CORE/src/View/View.php line 793 โ†’ Cake\Core\ObjectRegistry->load(string, array)
CORE/src/View/Helper.php line 148 โ†’ Cake\View\View->loadHelper(string, array)
CORE/src/View/Helper/FormHelper.php line 1605 โ†’ Cake\View\Helper->__get(string)
APP/Template/Articles/index.ctp line 28 โ†’ Cake\View\Helper\FormHelper->postLink(string, array, array)
CORE/src/View/View.php line 748 โ†’ include(string)
CORE/src/View/View.php line 709 โ†’ Cake\View\View->_evaluate(string, array)
CORE/src/View/View.php line 429 โ†’ Cake\View\View->_render(string)
CORE/src/Controller/Controller.php line 592 โ†’ Cake\View\View->render(null, null)
CORE/src/Routing/Dispatcher.php line 117 โ†’ Cake\Controller\Controller->render()
CORE/src/Routing/Dispatcher.php line 85 โ†’ Cake\Routing\Dispatcher->_invoke(App\Controller\ArticlesController)

Setting debug = false causes error, path not found

I don't think this is a cake core bug

Setup:

  • Follow instructions for manual installation in /var/www/test
  • Copy App/Config/app.default.php to app.php

Visiting localhost/test works fine.

Setting debug => false in app.php causes

Not Found
Error: The requested address '/test/' was not found on this server.

Unify translation strings with placeholder

Currently:

sprintf(
    __d('cake', 'The requested address %s was not found on this server.'),
    "<strong>'{$url}'</strong>"
)

but I think we should unify all to the new syntax {0} (which cakephp/cakephp uses throughout):

    __d('cake', 'The requested address {0} was not found on this server.',
    "<strong>'{$url}'</strong>")

Makes it also shorter, no need for sprintf() - but mainly consistent with the rest of the 3.x placeholder translations (no mixin of {0} and %s anymore.

Error: Class 'Cake\Utility\Validation' not found

After I installed CakePHP3 with composer, I visited the path and met below error:

Error: Class 'Cake\Utility\Validation' not found
File: /Applications/MAMP/htdocs/Cake3Demo/App/View/Pages/home.ctp
Line: 128

After I modified home.ctp at line 24
from "use Cake\Utility\Validation;"
to "use Cake\Validation\Validation;"

It's work fine.

Error installing Bake with composer

From @Tomicapo on June 8, 2015 2:44

I tried to install bake as documented at: http://book.cakephp.org/3.0/en/bake.html but I got the following error:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Can only install one of: cakephp/cakephp[dev-master, 3.0.6].
- Can only install one of: cakephp/cakephp[dev-master, 3.0.6].
- Can only install one of: cakephp/cakephp[dev-master, 3.0.6].
- cakephp/bake dev-master requires cakephp/cakephp dev-master -> satisfiable by cakephp/cakephp[dev-master].
- Installation request for cakephp/bake dev-master -> satisfiable by cakephp/bake[dev-master].
- Installation request for cakephp/cakephp == 3.0.6.0 -> satisfiable by cakephp/cakephp[3.0.6].

Installation failed, reverting ./composer.json to its original content.

Here's a copy of my composer.json:

{
    "name": "cakephp/app",
    "description": "CakePHP skeleton app",
    "homepage": "http://cakephp.org",
    "type": "project",
    "license": "MIT",
    "require": {
        "php": ">=5.4.16",
        "cakephp/cakephp": "~3.0",
        "mobiledetect/mobiledetectlib": "2.*",
        "cakephp/migrations": "~1.0",
        "cakephp/plugin-installer": "*",
        "cakephp/debug_kit": "~3.0"
    },
    "suggest": {
        "phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
        "cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
    },
    "autoload": {
        "psr-4": {
            "App\\": "src"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Test\\": "tests",
            "Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
        }
    },
    "scripts": {
        "post-install-cmd": "App\\Console\\Installer::postInstall",
        "post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

Copied from original issue: cakephp/cakephp#6754

RFC : Adding a `docker-compose.yml`

More and more people use docker to be able to build an environment identical for dev, test and prod.

I think this could be nice to add a docker-compose.yml at the root of the app skeleton. The objective is to be able to build an environment just by typing docker-compose up -d that will build all containers and link them together.

We could create official repositories in Docker Hub with basic cakephp images. At least 2 are needed:

  • for nginx or apache (we could create both)
  • for php-fpm
  • for mariadb, mysql or postgres (not required as official images are enough)

Theses images would rely on the official image of nginx and php. I can create the images under my username to test, and then we could transfer them to cakephp when everything works well. Of course, just if people see an interest on having docker integrated officially.

Any idea on this ?

Rename empty placeholder files to .empty

We should rename the placeholder files from a real filename to a dot prepended (hidden) file name such as .empty .
This fits to .gitattributes and other such meta files we use and have a special semantic use.

README clarification ?

This line:

"require": { "cakephp/app": "dev-master" }

Doesn't really work does it ? Composer cant't update the main package can it ?

Drop the use of TestShell and just use phpunit

The CakePHP core code in 3.0 has long dropped the use of the TestShell. I think doing the same for the app skeleton has a few benefits:

  • Less to learn. Most PHP developers using CLI runners will know how to use phpunit. Not using custom tools makes it easier to pick up CakePHP.
  • Simpler test harness. By using more basic tools there is less magic in the way. Also it allows the test runner to not depend on the host framework which is nice.
  • Allows CakePHP to be simpler. There is a non-trivial amount of code in CakePHP to support the TestShell and the web runner. Removing this code and just using phpunit lets us provide a simpler framework.

Web runner

Removing the TestShell and underlying libraries will result in the web test runner breaking as well. I think we have an opportunity to either use an existing web runner solution or build a standalone application that people wanting a web test runner can use.

Plugin webroot files being mingled

I created a plugin

$ bin/cake bake plugin MyPlugin

I created and saved style.css under MyPlugin/webroot/css

From my plugin layout

 $this->Html->css('MyPlugin.style')

The style.css content comes out mingled like below.

๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ}i๏ฟฝ๏ฟฝ7๏ฟฝ๏ฟฝ๏ฟฝyo๏ฟฝCn๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝL 

If I move the style.css to CakeDirectory/webroot/css/

The style.css is rendered with the correct encoding.

FYI Controllers, views, layout, models, and routing work for MyPlugin.

Thanks

Output an empty line when cake.bat is used

I think that an empty line should not be output at the top of output lines if there is no problem.
Because it has to be checked (at least in java) when command list is shown as XML. i.e. The output cannot be used directly...

Thanks.

DebugKit in require-dev

Hello,

Maybe my reflection is stupid, but I do not understand why DebugKit is in require.

Log::drop() not working from bootstrap_cli

It does not seem possible to drop the default log configurations in bootstrap.cli.php like this:

// Stop using the default CakePHP file loggers
Log::drop('debug');
Log::drop('error');

I have pinpointed it to the consume() line in bootstrap.php at line 134. If I place the CLI-bootstrap-overrides-include after this line things work as expected but I'm not sure if that messes up other things.

My workaround for now is simply deleting the log configurations in bootstrap_cli using:

Configure::delete('Log.debug');
Configure::delete('Log.error');

Problem when using Type::build('datetime')->useLocaleParser();

Basically I had the same issue with this guy on this question: http://stackoverflow.com/questions/32768919/cakephp3-newentity-nulls-date.

So to take it from the top I have a field appointment in the database which is datetime type. I use an input in a form which is type text for this field. When I submit the form after the patchEntity the field is returning null. The function that returns the null is https://github.com/cakephp/cakephp/blob/master/src/Database/Type/DateTimeType.php#L232 but I can't really figure out why.

If I remove the following lines https://github.com/cakephp/app/blob/master/config/bootstrap.php#L202 the field is not null but it is not an object. It is a string and can be saved successfully in the database.

If I use what is suggested here: http://book.cakephp.org/3.0/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data and set a local format setLocaleFormat('dd-M-y') the field after the patch it is returning as an object and can be saved successfully.

So right now I am a little bit confused... Is this a bug? Is this something that should be mentioned on the installation process or maybe should set a default locale inside bootstrap with setLocaleFormat() function in order to be more obvious that someone should change it to their needs and also document it with a proper DocBlock? Am I doing something wrong?

Licensing

Many of the files in this repo are copyright Cake Software Foundation and released under the MIT license. For example, see

app/config/routes.php

Lines 12 to 18 in 401ac46

* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @license http://www.opensource.org/licenses/mit-license.php MIT License
. This is kind of silly since this is boilerplate for users to create new applications with. As a result, every application created from this template requires the generated portions to not only remain copyright Cake Software Foundation, but to always carry the copyright and licensing information.

I'd recommend just waiving the rights under CC0 and removing any copyright and licensing information from the individual files that are app-specific.

Installation with composer

Hello,

When I install with composer cakephp/app, I've an InvalidArgumentException :
Maximum number of attemps must be a positive value

that occurs after a composer create-project and with a composer install

So, what does the installation ? just create the file config/app.php ?

Cordially

RFC/Suggestion: Change to the way that dispatcher filters are added

With the new middleware changes, dispatcher filters are hard-coded:

DispatcherFactory::add('Asset');
DispatcherFactory::add('Cache');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');

Should DispatcherFactory::add() not be altered to accept an array, and the above lines be changed to:

DispatcherFactory::add(Configure::consume('Dispatcher.filters'));

in order to make use of the App config.

Using ~3.0 pulls 3.1

What I did
Removed my vendor folder, cleared composer cache, and then updated. Using cakephp/cakephp: ~3.0 in my json.

What happened

  - Installing cakephp/cakephp (3.1.x-dev a87c87f)
    Cloning a87c87f1bc73059e3fcb5f0bbf16240e74099720

What I expected to happen
I was expecting 3.0.10 to be installed.

RFC: Adding support for `.env` files

This is something that could help local developers configure their setups much quicker. With the added support for DSNs in the core, it is now quite easy to get setup.

Why

This isn't a new way to configure applications. Many of us are already taking advantage of this in production through process managers such as Circus, SupervisorD, and Upstart. As well, all popular webservers support the usage of environment variables (SetEnv in Apache, and various ways with Nginx). In production at least, environment variables allow the changing of configuration without a deploy, which can be a godsend if, for example, your database goes away and you need to swap to a backup.

The other issue I'd like to tackle is different development environments for teams. It's annoying to have to change hardcoded config when moving from one database config to another (we don't all have my_app:secret setup), and having a .env file can obviate the need for people stepping over each other while changing config.

How

We can use josegonzalez/php-dotenv, a library I maintain, or vlucas/phpdotenv, which is used in Laravel. Both solve similar problems in different ways. The advantage with the former is that we have more control over features we want/need, though to be honest both would work adequately.

Using my library, we can add the following to our bootstrap.php file:

try {
    josegonzalez\Dotenv\Loader::load([
        'filepath' => __DIR__ . DS . '.env',
        'toServer' => true,
        'skipExisting' => ['toServer'],
        'raiseExceptions' => true
    ]);
} catch (InvalidArgumentException $e) {
    // do nothing in case the file doesn't exist
}

Here is a sample .env file that I use for vagrant based installations:

export APP_NAME=app

export DEBUG=2
export SECURITY_SALT="DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi"
export SECURITY_CIPHER_SEED="76859309657453542496749683645"

export DATABASE_URL="mysql://my_app:secret@localhost/my_app?encoding=utf8&timezone=UTC&cacheMetadata=true&quoteIdentifiers=false&persistent=false"
export DATABASE_TEST_URL="mysql://my_app:secret@localhost/my_app?encoding=utf8&timezone=UTC&cacheMetadata=true&quoteIdentifiers=false&persistent=false"

export CACHE_URL="file:///CACHE/?prefix=APP_NAME_&duration=DURATION"
export CACHE_CAKE_CORE_URL="file:///CACHE/persistent/?prefix=myapp_cake_core_&duration=DURATION&serialize=true"
export CACHE_CAKE_MODEL_URL="file:///CACHE/models/?prefix=myapp_cake_model_&duration=DURATION&serialize=true"

export LOG_DEBUG_URL=file:///LOGS/?levels[]=notice&levels[]=info&levels=[]=debug
export LOG_ERROR_URL=file:///LOGS/?levels[]=warning&levels[]=error&levels[]=critical&levels[]=alert&levels[]=emergency

export EMAIL_URL="mail://user:secret@localhost:25/?client=null&timeout=30&tls=null"

I do a few replacements in my app.php file like so:

'_cake_model_' => [
    'url' => str_replace(
        ['/CACHE/', 'DURATION'],
        [CACHE, '+2 minutes'],
        env('CACHE_CAKE_MODEL_URL')
    ),
],

I can likely make the library smarter and have it do it's replacements not only from bash but also from PHP constants or existing environment variables.

Errata

We'd need to add documentation on how .env files work. I have quite a bit of it in the readme for my project, but we'd want to add this to the main docs as well.

Note that this would maybe increase the complexity of setting up an app. We don't want to promote a .env file in production, but we do want to show users how to configure apps in production. Something to consider.

Developers might think this is something we've stolen from other frameworks, though this sort of thing has been around for quite a while. Rails has had automatic support for DSNs in environment variables since at least 3.x, and the friendsofcake/app-template project has used them for at least a year. As well, most/all of the core team has used this sort of functionality in the past, though maybe not with a php library to support their dev cycle.

Does adding this break BC? We've not yet made a release of the app composer project. Should we wait until a 3.1 CakePHP release before doing this? Or are we allowed to make changes like this without waiting for a major release.

Finally, does everyone desire this change? I know this makes it easy for me to write my book, and probably makes tutorial writing slightly easier, but maybe this isn't right for our users. Thoughts?

Composer create-project with custom app files

I'm new to composer and i'm trying to test 3.0 with a simple app.
I can install skeleton app and modify it with no problem using composer, but i would like to achive this goal:

  1. let composer install skeleton app using composer create-project
  2. ovewrite some skeleton files with mine in a svn repository

Using this pattern i can deploy my app using a simple composer.json

I can handle step 1 using

composer create-project -s dev cakephp/app

so that in app folder i find:

|- App <--- skeleton app
|- vendor <--- cake lib

Now i would like to take my files from svn and put them in App folder to get:

|- App
|- Config
|-- app.php (o)
[..]
|- Controller
|- AppController (o)
|-- MyTestController (n)
[..]

(o) files from my own svn
(n) new files from my own

I tried to create a new composer.json file with cakephp/app in require node as suggested but all i got is my app and cakephp app inside vendor directory :(

Is there a simple way to achive this?

How can i build a composer.json to say:

  1. install cakephp/app using standard composer.json (here on github)
  2. then install also my app from svn

so, i need - long story short - the correct composer.json structure to be sure to use the correct cakephp/app and then run my own installer to simply overwrite some skeleton files.

Suggestion: Default connection

Hey guys,

Some time ago I tried to install Bolt CMS because I heard a friend of mine about it.
The nice thing about it was that there's a default sqlite connection, but of course you can override it to your own mysql/whatever connection.
I liked this idea: let your user start as soon as possible.

My idea is to use a sqlite connection by default. I guess this app template would be the best place to do that?

I would like to hear what you think about it!

Greetz

Bob

Business logic in home.ctp

Why on earth are you performing business logic within home.ctp? All the values should be set in the controller.

ERR_CONNECTION_RESET at Table->get(...)->mapReduce

I'm trying to figure out a proper way to handle the new mapReduce instead of the old afterFind, when I tried to call it with the table's get the page just won't load.

It seems like this is a bug, at least the page should be loaded with an error.

Please, let me know if there's a better approach to handle results.
http://pastebin.com/8qP0FMPC

Configuration error

Fatal error: [Cake\Core\Exception\Exception] Could not load configuration file: config/inputContainerError.php #0 vendor/cakephp/cakephp/src/Core/Configure/Engine/PhpConfig.php(70): Cake\Core\Configure\Engine\PhpConfig->_getFilePath('inputContainerE...', true) #1 vendor/cakephp/cakephp/src/View/StringTemplate.php(180): Cake\Core\Configure\Engine\PhpConfig->read('inputContainerE...') #2
vendor/cakephp/cakephp/src/View/StringTemplateTrait.php(75): Cake\View\StringTemplate->load('inputContainerE...') #3
vendor/cakephp/cakephp/src/View/Helper/FormHelper.php(243): Cake\View\Helper\FormHelper->templater() #4
vendor/cakephp/cakephp/src/Error/ErrorHandler.php on line 155

How to show checkbox checked

in cakephp new version 3.0 which argument we have to show multiple checkboxes checked.

$options = array(1 => 'ONE', 'TWO', 'THREE');
$selected = array(1, 3);
echo $this->Form->input('interiors', ['multiple' => 'checkbox', 'options' => $options, 'default' => $selected]);

Add a REPL using boris

CakePHP used to have a crappy REPL via the ConsoleShell. Times have changed and there are now really great REPL offerings. One good option is http://github.com/d11wtq/boris. I've used it in some other projects and it is very robust and nice to use. It can be configured to have some preset local scope and also pre-bootstrap the application.

One drawback to all of the existing REPL solutions is windows support. Most of them do not work well on windows due to readline and posix extensions not working very well.

Given that windows support will not be ideal is it worth making a REPL available as a dev dependency?

Is i18n.sql outdated?

In the book, the recommended CREATE TABLE sentence for i18n table is:

CREATE TABLE i18n (
    id int NOT NULL auto_increment,
    locale varchar(6) NOT NULL,
    model varchar(255) NOT NULL,
    foreign_key int(10) NOT NULL,
    field varchar(255) NOT NULL,
    content text,
    PRIMARY KEY     (id),
    UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field),
    INDEX I18N_FIELD(model, foreign_key, field)
);

i18n.sql has comments in a lot of indexes and isn't really following the book example.

Startup error

Just created an empty project with composer and I get:
Error: Controller could not be found. Error: Create the class Controller below in file: App\Controller\Controller.php

I knew this is wrong, but created the file anyway. Still got no luck in starting with Cake3.

4.0 - RFC - A new folder for controllers actions and prefix

4.0 - RFC - A new folder for controllers actions?

I was wondering about the possibility of adding a new folder to keep the controller actions templates separated from the others.

Right now the agglomeration of similar named folders prevent some prefix naming. For example:

There will be a restriction if someone has decided to use a route prefix like element, email, or any other name that already exists as default template folder.

Another separation that I think may be interesting is to create a folder for prefixed templates.

Sometimes we have folders named like Admin for the prefixed templates, and Admins for the default admins controller actions.

This is someway visually confusing.

What do you think about the following structure for the action templates?

app
|____src
     |____Template
          |____Action

And this following one for the prefix folders?

app
|____src
     |____Template
          |____Action
               |____Prefix

I was wondering about it and I would share with you.

I don`t know if it breaks some MVC patterns that you guys had chosen. If it does, sorry.

Fatal error on home

Hi!

On a fresh composer create-project -s dev cakephp/app I see this error:

Error: Call to undefined method Cake\Datasource\ConnectionManager::getDataSource()  
File /Users/lucas/Sites/neosolutions/cakephp/ecommerce/src/Template/Pages/home.ctp  
Line: 104

It occurs even after I configure the database.

Cannot use Plugin theme for render error

Dear all.
My ExceptionRender doesn't use Plugin layout to render error.
project structure:
http://imgur.com/mDrTzqR

/app/Plugins/Stanley/src/Template/Layout/default.ctp
/app/src/Template/Layout/default.ctp

I'm set theme, load plugin, set layout at beforeFilter like this:

    public function beforeFilter(Event $event) {
        parent::beforeFilter($event);
        $theme = 'THEME01';
        $this->theme = $theme;
        Plugin::load($theme);
        $this->layout = $theme;
    }

when i throw new exception

    public function project($slug = null) {
        $this->loadModel('Projects');
        if (!$slug) {
            $this->set('projects', $this->Projects->find());
        } else {
            $project = $this->Projects->find('slug', ['slug' => $slug]);
            if (!$project) {
                throw new NotFoundException(__('Invalid project'));
                //ExceptionRender use /app/src/Template/layout/default.ctp to render error, doesn't use /app/Plugins/Stanley/src/Template/layout/default.ctp
            }
            $this->set('project', $project);
        }
    }

I'm using cakephp v3.0 beta2.
I asked on IRC channel but in vain.
Please help me.
Thanks

RFC - Adding the migrations plugin by default

To improve awareness of this plugin and to encourage plugins to use migrations when distributed, I think it would be a good idea to add the migrations plugin by default to the composer.json of the app template

cake.bat unneed comment

Do we realy need the comment in cake.php
:: In order for this script to work as intended, the cake\console\ folder must be in your PATH

Where is cake\console\ when using cakephp 3+

Installation process makes tmp, logs world writable.

While making dirs world writable is convenient to get going, it's far from ideal for obvious reasons.

It would be nice to be able to skip this step by providing a command line switch or better yet make the installer interactive and ask for confirmation whether perms change should be done.

Error installing Bake with composer

From @Tomicapo on June 8, 2015 2:44

I tried to install bake as documented at: http://book.cakephp.org/3.0/en/bake.html but I got the following error:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Can only install one of: cakephp/cakephp[dev-master, 3.0.6].
- Can only install one of: cakephp/cakephp[dev-master, 3.0.6].
- Can only install one of: cakephp/cakephp[dev-master, 3.0.6].
- cakephp/bake dev-master requires cakephp/cakephp dev-master -> satisfiable by cakephp/cakephp[dev-master].
- Installation request for cakephp/bake dev-master -> satisfiable by cakephp/bake[dev-master].
- Installation request for cakephp/cakephp == 3.0.6.0 -> satisfiable by cakephp/cakephp[3.0.6].

Installation failed, reverting ./composer.json to its original content.

Here's a copy of my composer.json:

{
    "name": "cakephp/app",
    "description": "CakePHP skeleton app",
    "homepage": "http://cakephp.org",
    "type": "project",
    "license": "MIT",
    "require": {
        "php": ">=5.4.16",
        "cakephp/cakephp": "~3.0",
        "mobiledetect/mobiledetectlib": "2.*",
        "cakephp/migrations": "~1.0",
        "cakephp/plugin-installer": "*",
        "cakephp/debug_kit": "~3.0"
    },
    "suggest": {
        "phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
        "cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
    },
    "autoload": {
        "psr-4": {
            "App\\": "src"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Test\\": "tests",
            "Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
        }
    },
    "scripts": {
        "post-install-cmd": "App\\Console\\Installer::postInstall",
        "post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

Copied from original issue: cakephp/cakephp#6754

Plugins do not load entities nor repositories

I'm not sure if there's something I do not understand... but here I go.

Reading the documentation, under the new ORM Models section there's very well explained how to use entities and repositories, but when you check the models section under the Plugins documentation it seems like plugins can only work with models ala Cake 2.0.

Also, I've been testing it and Cake does not seem to load files under folders PLUGIN\Model\Repository and PLUGIN\Model\Entity.

Will plugins, in a near future, also work with entities and repositories? Or they should be working right now? If so, what am I missing?

Form Helper

How can I set input wrapper div class in CakePHP 3.0.
My Code:

Form->input('mobile',['div'=>['class'=>'col-md-4'],'class'=>'form-control','label'=>false]) ?>

PagesController broken

Problem
"PagesController could not be found" error immediately after installing CakePHP3 App and Core.

Steps to recreate:

  1. composer installed cakephp app
  2. downloaded core insto vendor/cakephp/cakephp
  3. renamed App/Config/app.default.php to App/Config/app.php
  4. went to http://localhost and I get:

Screenshots of the error:
https://www.dropbox.com/s/mbh00u3mtaok75e/Screenshot%202014-01-19%2019.17.58.png
https://www.dropbox.com/s/zbsclyvnc7kfgm2/Screenshot%202014-01-19%2019.18.06.png

System Information
MAMP with PHP 5.5.3
EDIT: Also tested this with PHP 5.4.19

Let me know if the above is not sufficient enough information.

Does not print missing view

I just installed cakephp3, done composer install

Now i created a controller accessing to url root/controller.
It should print 'Hey there there is a missing template file "Controller/index.ctp".

Instead i got an Fatal error:
xdebug

wrong bake template code in view

In file: vendor/cakephp/cakephp/src/Template/Bake/Template/view.ctp
Line 87 cols 340-344

<p><?= $<%= $singularVar %>->has('<%= $details['property'] %>') ? $this->Html->link($<%= $singularVar %>-><%= $details['property'] %>-><%= $details['displayField'] %>, ['controller' => '<%= $details['controller'] %>', 'action' => 'view', $<%= $singularVar %>-><%= $details['property'] %>-><%= $details['primaryKey'][0] %>]) : '' %>" ?></p>

Should be:

<p><?= $<%= $singularVar %>->has('<%= $details['property'] %>') ? $this->Html->link($<%= $singularVar %>-><%= $details['property'] %>-><%= $details['displayField'] %>, ['controller' => '<%= $details['controller'] %>', 'action' => 'view', $<%= $singularVar %>-><%= $details['property'] %>-><%= $details['primaryKey'][0] %>]) : ''  ?></p>

Exclude 'empty' files in .gitignore

I've tried to add some exclusions to .gitignore so the first time you do a git add . the tmp and logs folder are also added.

I was creating a PR with these changes but I'm not able to add the exclusions for the tmp folder. It seems that git ignores its subfolders.

Taking the current .gitignore file:

/vendor/*
/config/app.php
/tmp/*
/logs/*

The empty file in the logs folder can be excluded like so:

/vendor/*
/config/app.php
/tmp/*
/logs/*
!/logs/empty

But with the tmp folder, I've tried (without success) all these convinations:

!/tmp/**/empty
!/tmp/*/*/empty
!/**/empty # try to exclude every empty file found (does not work with more than one level)
!empty

As said, none of them work (at least not in my git environment..).

I think that it would be great to find a way to exclude these files as I'm sure I'm not the only one who needs to manually add these folders after the first clone (because composer install crashes when tries to apply its permissions).

If we cannot add the .gitignore exclusions maybe the folder creation could be managed by the composer post-install script.

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.