开发者

cakephp - manually create records for model without a table

开发者 https://www.devze.com 2023-03-27 08:34 出处:网络
I need several models, but since the data size is not more than 5 records each, it seems like a waste to use db-table.

I need several models, but since the data size is not more than 5 records each, it seems like a waste to use db-table. how should I do it?

these models are supposed to be linked开发者_JAVA百科 to other models


sounds like some kind of enum to me. if it is (does not change very much or does not need a frontend to add/edit/delete) you can put it in the model code and use sth like http://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/

if you need to have a crud backend for it to edit it online you could group them together to a model maybe called "list_items" with a "type" field to distinguish the different models you are talking about. this way you have one model holding all those enums and you can provide add/edit/delete access for them for users/admins.


you can use array datasource One advantage of it is you can treat it like a model (linking to other models, do find() query, etc.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号