Cakephp

How to use CakeBake on CakePHP3 on a Windows Xampp or Wamp enviroment

How to use CakeBake on CakePHP3 on a Windows Xampp or Wamp enviroment


How to use CakeBake on CakePHP3 on a Windows Xampp or Wamp enviroment

This probably works like most thing once you done it once you'll realise it is extremely easy. Once you have set up Cakephp with Composer (see our little tutorial 'How to install CakePHP 3 on Xampp' ) All you have to do is the following.

Before you start with Cakebake. Cakebake Bakes a database, so you will need a database schema, either you have to build the database yourself in PHPMyAdmin or download on.
Crucially every table needs an PRIMARY KEY. So each one of my tables starts with an ID which is a PRIMARY KEY and also is set to AUTO_INCREMENT

EXAMPLE:

TABLE: USERS
id, user_name, user_email.

TABLE ORDERS
id, users_id, order_name

So that if you have dependencies between id's that they use the correct format for CakeBake to read.
Your database is your MOST CRUCIAL STEP IN THIS WHOLE PROCESS. So make sure it is as close to perfect as you can get it spend proper time on this.


Now, configure your CakePHP3 installation tell it which database to use. In the 'core.php' file, update the HOST, USER, PASSWORD, DATABASE

So for a local Xampp or Wamp installation it will be host (localhost or 127.0.0.1) user (root), password (''), database ('yourdatabase')

  • In windows click start, type in cmd this will open the command prompt.
  • navigate using cd ../ or cd foldername to get to the following location in xampp C:/xampp/htdocs/app/bin
  • To view all CakeBake commands type in cake bake
  • To view all tables that can be baked type in cake bake all
  • To bake all models in one go type in cake bake model all
  • To bake all controllers in one go cake bake controller all
  • To bake all 'views' 'in cake bake type in cake bake template all
  • To bake a specific controller/view/model type in cake bake controller/view/model table name

 

Please feel free to email me or comment if you have any questions

Published: 14th July 2016 by

Adverts