原则ORM:不尊重案件的模式 [英] Doctrine ORM: Models not respecting case

查看:106
本文介绍了原则ORM:不尊重案件的模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为UserDegree的mysql数据库表,当我尝试使用Doctrine导入到PHP时,它会生成一个模型名称Userdegree,有没有办法解决这个问题?



<我真的找不到任何好的教义文件。



谢谢!

解决方案

我不确定你的具体问题,但是对于良好的教义文档部分,你是否尝试使用手册?请参阅 PHP的PHP教程ORM - 我认为实际上是相当不错的,特别是与某些其他项目相比,没有太多的文档或完全陈旧的项目。



关于你的问题(正如我之前所说,不确定) :我认为Doctrine从数据库中的表名中获取每个单词,并将其转换为PHP的名称。很多时候,表名中的单词用下划线 _ 分隔,并且都在较低或两种情况下。



我想,如果您将表 user_degree 命名,而不是 UserDegree ,该原则应该检测它由两个单词组成,并创建一个名为 UserDegree 的PHP类 - 实际上,我用一个名为 post_has_tag ,它生成一个名为 PostHasTag 的类。


I have a mysql database table called UserDegree, when i try to import back to PHP using Doctrine it generates a model name Userdegree, is there a way to solve this?

i really can't find any good doctrine documentation.

thanks!

解决方案

I am not sure about your specific problem, but for the "good doctrine documentation" part, did you try the manual ? See Doctrine ORM for PHP -- I think it's actually quite good, especially compared to what you get with some other projects, that don't have much documentation, or totally outdated.

About your problem (as I said before, not sure) : I suppose Doctrine takes each "word" from the table name in the DB, and converts that to a "name" for PHP. Quite often, "words" in table names are separated by an underscore '_', and are all in either lower or either case.

I suppose, if you name your table "user_degree", instead of "UserDegree", that Doctrine should detect it's composed of two "words", and create a PHP class called "UserDegree" -- actually, I tested with a table called post_has_tag, and it generates a class called PostHasTag.

这篇关于原则ORM:不尊重案件的模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆