I have been using Cakephp ver2.x and just started migrating to Cakephp v3.x. When I tried using the new ORM, I am baffled by basic concepts like repositories and table objects. What is the difference between repositories and table objects?
1条回答 默认 最新
- dsjbest2015 2015-05-08 09:24关注
A repository can be anything while a table, as the name states, is just a table.
http://api.cakephp.org/3.0/class-Cake.ORM.Table.html
Represents a single database table.
Exposes methods for retrieving data out of it, and manages the associations this table has to other tables. Multiple instances of this class can be created for the same database table with different aliases, this allows you to address your database structure in a richer and more expressive way.
http://api.cakephp.org/3.0/class-Cake.Datasource.RepositoryInterface.html
Describes the methods that any class representing a data storage should comply with.
A data storage can be any kind of storage system, even one that doesn't know tables like a graph DB or document based system.
It is always simple to just check the API documentation and code for this kind of questions. The code is pretty well documented. Also the way this works becomes obvious then:
class Table implements RepositoryInterface, EventListenerInterface
Table implements the interface defined by RepositoryInterface.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 cplex运行后参数报错是为什么
- ¥15 之前不小心删了pycharm的文件,后面重新安装之后软件打不开了
- ¥15 vue3获取动态宽度,刷新后动态宽度值为0
- ¥15 升腾威讯云桌面V2.0.0摄像头问题
- ¥15 关于Python的会计设计
- ¥15 聚类分析 设计k-均值算法分类器,对一组二维模式向量进行分类。
- ¥15 stm32c8t6工程,使用hal库
- ¥15 找能接spark如图片的,可议价
- ¥15 关于#单片机#的问题,请各位专家解答!
- ¥15 博通raid 的写入速度很高也很低