• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Whokay 必ず勝つ!頑張ろう!
博客园    首页    新随笔    联系   管理    订阅  订阅
Symfony中Doctrine对应的Mongodb数据类型 data type

1. hash 就是 json对象

2. collection 就是 数组

 

3. 若要知道如何使用referenceOne, referenceMany, embbedDocument等

主要查看:

http://doctrine-mongodb-odm.readthedocs.org/en/latest/reference/reference-mapping.html

http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/embedded-mapping.html#embed-many
http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/basic-mapping.html#doctrine-mapping-types
以上部分主要看yaml部分,就会知道如何编写 yml 了。
http://doctrine-mongodb-odm.readthedocs.org/en/latest/reference/basic-mapping.html
 
 
HasLifecycleCallbacks事件:
http://doctrine-mongodb-odm.readthedocs.org/en/latest/reference/annotations-reference.html
 
了解更多:
http://us.php.net/manual/zh/class.mongodbref.php
 
 
 
比较典型的yml:
 
Documents\User:
  fields:
    id:
      type: id
      id: true
    name:
      type: string
    email:
      type: string
  referenceMany:
    posts:
      targetDocument: Documents\BlogPost
      cascade: all

Documents\BlogPost:
  fields:
    id:
      type: id
      id: true
    title:
      type: string
    body:
      type: string
    createdAt:
      type: date
 
posted on 2014-03-06 00:37  Vince  阅读(1027)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3