有关 Doctrine ORM 的 YAML 映射的完整文档?
实体的 YAML 映射文档 似乎缺乏。它没有解释什么是不同的类型、不同的生成器策略、mappedBy 的含义、允许什么类型的级联值、如何定义多对一关系等等。在哪里可以找到此 YAML 文件的完整文档?
The YAML mapping documentation for entities seems to be lacking. It doesn't explain what the different types, the different generator strategies, what mappedBy means, what types of cascade values are allowed, how to define a many-to-one relationship, and a whole lot more. Where can I find full documentation for this YAML file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不幸的是,目前原则 2 的 yaml 格式文档非常有限。
目前,了解 yaml 格式的最佳方法是查看 yaml 驱动程序实现。
Doctrine\ORM\Mapping\Driver\YamlDriver
通读
loadMetadataForClass
方法的实现。这会向您显示驱动程序在哪里期望什么属性。您还可以查看注释文档来补充您的理解。许多记录的字段名称和期望值与 yaml 格式相同。例如:一旦您确定
@column
对应于 yaml 格式的fields
元素,该元素的其余注释文档就与 yaml 格式一致。Unfortunately, the yaml format documentation for doctrine 2 is pretty limited at the moment.
Right now, the best way to figure out the yaml format is to look at the yaml driver implemetation.
Doctrine\ORM\Mapping\Driver\YamlDriver
Read through the the implementation of the
loadMetadataForClass
method. That shows you what properties the driver is expecting where.You can also look at the annotations documentation to supplement your understanding. Many of the documented field names and expected values are the same as the yaml format. For example: once you figure out
@column
corresponds to thefields
element of the yaml format, the rest of the annotations documentation for that element lines up with the yaml format.您可以查看位于Doctrine\Orm\Mapping\ClassMetadataInfo 类,
在该类中您可以找到大部分可能的内容。如果你仔细阅读评论,它会给你一个更好的想法。
You can have look at Doctrine\Orm\Mapping\ClassMetadataInfo class located at
In this class you can find mostly what's possible. If you read the comments carefully it will give you a better idea.
v1.2 手册更加完整。
The v1.2 manual is much more complete.