Creating a CakePHP REST api from an existing proje

2019-08-14 00:10发布

I have a webapp which I am planning on converting into a REST api and have decided to use CakePHP for this - the current form is written in ColdFusion.

The database is a couple million records in size with 20 tables or so and a few associative tables that handle the many-to-many situations.

I'm looking for the best method to start the CakePHP solution mainly in regards to the database. Should I import my existing db and just use cake to access its current form? Should I bake a fresh database structure (in order to stay within the cake standards) then figure out how to get my data into the new db, and maintain relationships etc (how?)?

Edit:

There are many users on the existing app, but when the new CakePHP api is setup and ready to go, the old service will be closed to use the new one.

The current app is not designed in an MVC way, are you referring to Models as being synonymous with Tables? There are many existing tables with foreign key relationships but they are not named using the CakePHP standards - so not sure if this will break CakePHP or make its features not as usable.

Time is an issue, but I'd rather take the time now and get it done the correct way, instead of having to re-visit shortly.

1条回答
SAY GOODBYE
2楼-- · 2019-08-14 00:59

I largely depends on your situation:

  • Are there people using the old application? - This will mean you can't really create another database for your new app if you want to access new information.

  • Is there really a need to change the relationships of models? - I don't think you should change unless you really need to.

  • Cost - How much time are you willing to spend on the migration?

Note: You can modify almost everything on your model to cope up with the previous database/table structure.

查看更多
登录 后发表回答