adinugro
(Adinugro)
July 14, 2017, 11:50pm
1
I am still learning about yii2.
One thing that I cannot understand is, in yii1, usually I just copy from old project when making a new project. remove unnecessary files and start the development.
in yii2, I cannot do so.
Copy from old project the whole directory
change the database connection on main-local.php
run php init
But why, I still got connection to old database?
Can someone help?
TIA
Daniel
jkofsky
(Jkofsky)
July 15, 2017, 12:08am
2
Daniel:
I am still learning about yii2.
One thing that I cannot understand is, in yii1, usually I just copy from old project when making a new project. remove unnecessary files and start the development.
in yii2, I cannot do so.
Copy from old project the whole directory
change the database connection on main-local.php
run php init
But why, I still got connection to old database?
Can someone help?
TIA
Daniel
From your question, it appears that you are using the advanced template.
When you run init: Do you choose ‘Production’ or ‘Development’?
Do you overwtite the config files?
What is in your ‘environment’ directory config files?
From another of my post:
Something that I recently discovered was the environment directory.
Then run the init file and select development on dev, [1] Production on the server. The first time it is run, it does a lot. the subsequent times, it only copies the environment/? directories. When run the second+ time, it will ask if you want to overwrite somefiles, it’s OK, it’s just moving the files under environment/? to the main area.
you only have to do this once, unless you overwrite the main-local config files when you update the server. The .gitignore files already know not to update the *-local.php files in the main config areas.
You can test this on your dev machine.
Edit environment/dev/config/main-local.php, to put the un-min files to be reqistered.
Edit environment/prod/config/main-local.php, to put the min versions to be reqistered.
Then run init, set to [0]dev. run your site and see what files showed up.
Then run init, set to [1]prod. run your site and see what files showed up.
Just remember to copy all the OTHER changes that you have made to the various *-local files, BEFORE you run the ‘init’ command.
Maybe this will help.
adinugro
(Adinugro)
July 15, 2017, 1:48pm
3
yes, to be complete, I am using kartik practical a which based on kartik practical which is based on advanced template.
jkofsky:
When you run init: Do you choose ‘Production’ or ‘Development’?
Do you overwtite the config files?
What is in your ‘environment’ directory config files?
From another of my post:
Maybe this will help.
I run init and choose development.
I do not override config files, since I did it manually before running php init.
I never touch environment folder