I’ve been handed a web site, written in CakePHP to modify, and I am loving it! The theme and documentation are wonderful; and I love how organized the code is.
My task is to modify a database relationship, between two tables, from being one-to-many to a many-to-many; or in cake terms from a “hasMany” to a “hasAndBelongsToMany”.
I created the new intermediary table (in the MySql database) for the many-to-many relationship, but I’m trying to figure out where to go from there.
Should I run bake now that the table is created? Would that be the best next step?
What’s the best method to find out each of the files I’ll need to change the code in? I’ve used Notepad++ and have done a Search->Find In Files… to look for the name of one of the tables in the relationship, within the code. But with the data being organized into MVC, I think there must be a better way to identify all the areas where the code I need to modify is. I know each table has a view, controller and a model. Are those three places all inclusive; or are there other files and folders I should look into too?
(I’m somewhat new to the MVC design pattern in PHP. I understand the concept; but I’m used to having PHP and HTML all in one file, and being able to see a visual in DW. So having the code organized in MVC with no visual, has been quite the learning curve for me. )
Thanks so much.