Cake doesn't not bake all templates - cakephp

I have created 3 database tables which follows
the CakePHP naming convensions. When I try to bake the code with the following command it generates only 3 files in the 'App/src/Template/Worksheets' which is
'view', 'add' and 'edit'.
i.e bin\cake bake all worksheets
There is no 'index' file being generated, only the ones mentioned above.
When I started developing the app the bake command work flawlessly and generated the 'index' file with no problems at all.
Cake doesn't give any errors in the console and it just runs without baking a template for 'index'.
Is there a way to fix this?

So if you type this command in console, after you have baked all the other views, you can create those which is missing. I.e index.ctp
cake bake template <model> <action>
And for my problem:
bin\cake bake template worksheets index
This works flawlessly.

Related

cakephp error Table class for alias xxx could not be found

This is my first time with cakephp (using xampp and phpmyadmin) and I just created table orders and controller for it in terminal using command: .\cake bake controller orders, but when i open it there is an error error pic. I tried with other names and tables but nothing worked. How do I fix it?
You should create model
run in terminal
./cake bake model orders

How to add a field in database table by cakephp migration?

I am very new in cakephp version 3. Here I am trying to use migration plugin. I have already created a table by using below command
=> cake bake migration CreateUsers name : string
It's worked very fine, now I am trying to add a field in here so I have written
=> cake bake migration add age:int to Users
It's not working. How can I add this field by migration using shall command ?May you help me please ?
A syntax like
add column:type to table
doesn't exist, so that's why you are seeing what you're seeing. The correct syntax for adding columns is
AddColumnNameToTableName column:type
where the column name between Add and To is optional.
ie your command should look something like
bin/cake bake migration AddAgeToUsers age:int
See
Cookbook > Migrations > Creating Migrations
https://github.com/cakephp/migrations

CakePHP bake stacked by database Config:

It's the first time I made a bake through the CakePHP console.
I run the cmd as admin and there is a strange thing that after setting
the database config: (default/test) it is stucked there and I don't know
why.
The environment path is setting up correctly.

include cakephp plugin output in my app controller

I've just started with CakePHP and am having a problem withe the concept of plugins and components.
The main issue is how to include their views in my own app. For example, on the cakephp site, there is a tutorial for plugins, but they never mention how to include it in the output of my own app.
I want to create a login bar that appears on every page of my site. You know, something that either says Username Password or Welcome Fred Flintstone at the top of every page.
It seems a plug-in would be best for this as it could be included in every controller I created. But, as I mentioned, I have no idea how to include the plugin view with my app views.
lee
In this case, you would create an element:
/app/View/Elements/login_bar.ctp
echo $this->Form->create('User');
echo $this->Form->inputs(array('username', 'password'));
echo $this->Form->end('login');
and include it in your views (or layout) with:
echo $this->Element('login_bar');
See: http://book.cakephp.org/2.0/en/views.html#elements

cakephp bake console acting weird?

I'm pretty new to CakePHP and i'm running through both the Cake Book and the Apress Book CakePHP from novice to professional, but i can't seem to understand what's going on on my bake console.
I've got it installed and seems to work fine. But when i type in cake bake it shows me this
Welcome to CakePHP v2.0.0 Console
--------------------------------------------------------------------
App: htdocs
Path: W:\xampp\htdocs\
--------------------------------------------------------------------
What is the path to the project you want to bake?
[W:\xampp\htdocs\myapp] >
instead of what the books say it should be
---------------------------------------------------------------
App : app
Path: /path-to/project/app
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
>
if i follow the questions on my cake console, it asks me the path to the directory layout i wish to copy, and then seems to override everything i have with that skel one.
on the other hand, if i follow the book's steps and type cake bake view or cake bake model it seems to understand that i'm talking about projects named view and model and tell me there's no database configuration for those projects, etc. So, if i type the project path first, i don't get to choose what to do. But if i leave it out, it has no way of knowing. See where this is going?
I'm using the regular Windows cmd.exe, not cygwin as i've seen some people recommending, and can provide more detail if needed. There's probably an easy solution for this, so I appreciate your help!
you are in the wrong path.
If you want to bake internal stuff (models, controllers, views, ...) etc
you need to navigate to the app folder and execute cake there
(or define your app path with -app)
details and hot tip for windows:
http://www.dereuromark.de/tag/cake-console-windows/

Resources