从现有项目创建CakePHP REST API [英] Creating a CakePHP REST api from an existing project

查看:55
本文介绍了从现有项目创建CakePHP REST API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Webapp,我打算将其转换为REST api,并决定为此使用CakePHP-当前形式是用ColdFusion编写的。

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.

数据库的大小为几百万条记录,其中有20个左右的表以及一些关联表,这些表可以处理多对多情况。

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.

我正在寻找启动CakePHP解决方案的最佳方法,主要针对数据库。我应该导入现有的数据库并仅使用cake访问其当前表单吗?我是否应该烘焙一个新的数据库结构(以保持在蛋糕标准之内),然后弄清楚如何将我的数据保存到新的数据库中,并维护关系等(如何?)?

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?)?

编辑:

现有应用上有很多用户,但是当新的CakePHP api设置好并准备就绪时,旧服务将关闭使用新的。

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.

当前应用不是以MVC方式设计的,您是否将Models与Tables等同?现有的表中有许多具有外键关系的表,但它们不是使用CakePHP标准命名的-因此不确定是否会破坏CakePHP或使其功能无法使用。

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.

推荐答案

我在很大程度上取决于您的情况:

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.

这篇关于从现有项目创建CakePHP REST API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆