发表于 2015-7-9 09:27:42

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
页: [1]
查看完整版本: Symfony中Doctrine对应的Mongodb数据类型 data type