duandou9931 2015-05-08 01:15
浏览 30
已采纳

cakephp v3.x中的存储库和表对象有什么区别?

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 01: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 安卓下载未上架的apk进行安装 但是提示应用未安装 是国外的Oppo Reno6 5G手机
  • ¥15 在ros2的iron版本进行编译时遇到如下问题
  • ¥18 vs用setup project打包项目实现安装完立即运行
  • ¥15 孟德尔随机化TwoSampleMR在线提取结局数据,遇到Error in check_reset(override_429)的问题
  • ¥15 ONNX转RKNN遇到问题
  • ¥60 以太网电缆未接通怎么处理
  • ¥15 关于超声图片进行放射组学的疑问
  • ¥20 已经有功率放大电路图,具体每个元器件的参数怎么算?
  • ¥15 用GIS怎么提取出一个城市的中心城区
  • ¥30 matlab代码调试
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部