I got started with my new CakePHP 3.x project today. As usual I wanted to create a few scaffold using cake bake
command. As I already had a CakePHP 2.x setup in my machine. I still needed it and its cake bake
commands to run to create any thing while working on the cakephp 2.x project. So is there a way I could use both cake bake consoles for CakePHP 2.x and 3.x respectively, at the same time?
Answer is YES. All we need to do is make some tweaks in order to run them both. Here are what I did.
- I actually went back into the CakePHP 2.x installation and renamed the cake and cake.bat to cake2 and cake2.bat respectively. There are located in C:\wamp\www\mycakephp2app\lib\Cake\Console.
This step actually was to set path environmental variable manually for CakePHP 3 as I already had set it up for CakePHP 2.x on my windows machine. I actually need them both. So I would add them like this C:\wamp\www\mycakephp2app\bin;C:\wamp\www\mycakephp2app\lib\Cake\Console;(for cakephp 3 it is set automatically.If you installed Cakephp 2 after CakePHP was installed you have to set the environmental variable path accordingly)
- As you might have noticed that I renamed cake and cake.bat shell scripts to cake2 and cake2.bat respectively I need to run cake2 bake in order to invoke CakePHP baker.