Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP 2.2.2 bake for plugin

Tags:

cakephp-2.1

I am trying to bake models, controllers and views for my plugin in my app called: admin. I am using windows 7. Bake works when baking an app and within the app.

This is what I am doing:

  1. cd c:\wamp\www\propharm\app (also tried without \app)
  2. cake bake plugin admin model

This is the folder my plugin resides in: C:\wamp\www\propharm\app\Plugin

I get this in response from the console.

Create the directory structure, AppModel and AppController classes for a
new plugin. Can create plugins in any of your bootstrapped plugin paths.

Usage:
cake bake plugin [-h] [-v] [-q] [<name>]

Options:

--help, -h     Display this help.
--verbose, -v  Enable verbose output.
--quiet, -q    Enable quiet output.

Arguments:

name  CamelCased name of the plugin to create.
      (optional)

I tried this: in bootrap.php

CakePlugin::load('Admin');

Its still not working. If someone knows what I am doing wrong, please help. thanks. Louis

like image 828
louis_coetzee Avatar asked Dec 15 '22 19:12

louis_coetzee


2 Answers

1) Bake your plugin:

cake bake plugin PluginNameInCamelCase

2) Bake everything else:

cake bake controller ControllerName --plugin PluginNameInCamelCase

See this page for further documentation in baking plugins: Creating Your Own Plugins with CakePHP

like image 146
alairock Avatar answered Jan 07 '23 12:01

alairock


Although above code works but this code provide more useful options.

Step 1: Create Plugin

cake bake plugin PluginNameInCamelCase

Step 2: Create Model

cake bake model plugin --PluginNameInCamelCase`

It will show list of available models, select you want to bake like user model, news model etc

Step 3: Create Controller

cake bake controller plugin -- PluginNameInCamelCase

It will show list of available controllers, select you want to bake like user controller, news controller etc

Step 4: create finally view files for your plugin

cake bake view plugin --PluginNameInCamelCase

It will show list of available controllers for which you want to make view files, select and done!

Read more

like image 38
RN Kushwaha Avatar answered Jan 07 '23 14:01

RN Kushwaha