为什么我不能创建一个名为“Album”的Doctrine模型 [英] Why can't I create a Doctrine model named 'Album'

查看:90
本文介绍了为什么我不能创建一个名为“Album”的Doctrine模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



使用以下YAML:


$ b $

我在项目中使用Doctrine作为ORM,但是出现了一个奇怪的错误: b

 相册:
tableName:dpp_album
actAs:[Timestampable]
列:
名称:字符串(255)
描述:string(255)
online:boolean

然后我生成我的模型,刷新我的页面并自动加载模型,PHP发送此错误:


致命错误:类BaseAlbum不是

E:\sites\dpp\system\application\models\Album.php
第13行


奇怪的是,我所有的其他模型都很好,在这些情况下可以找到基类。



将名称Album更改为设置它只是工作!是不是很奇怪?



所以似乎使用专辑以某种方式冲突,尽管错误信息表明其他的东西。



任何建议?



谢谢!

解决方案

如果选项 generateBaseClasses 被设置(默认)generateModelsFromYaml()将在你的情况下创建一个类 AlbumBase (默认情况下,在子目录生成)和一个空类相册扩展AlbumBase 。即如果相册被实例化 AlbumBase 必须已被某些自动加载机知道或加载。


I'm using Doctrine as ORM in my project but ran against a strange error:

Using following YAML:

Album:
  tableName: dpp_album
  actAs: [Timestampable]
  columns:
    name: string(255)
    description: string(255)
    online: boolean

I then generate my models but upon refreshing my page and autoloading the models, PHP serves this error:

Fatal error: Class 'BaseAlbum' not found in E:\sites\dpp\system\application\models\Album.php on line 13

Strangely enough all my other models are just fine and the Base Classes are found in those cases.

When changing the name 'Album' to something like 'Set' it just works! Ain't that strange?!

So it seems the using 'Album' somehow conflicts, although the error message suggests something else. Change to the plural Albums also doesn't work, anything else is just fine!

Any suggestions?

Thanks!

解决方案

If the option generateBaseClasses is set (default) generateModelsFromYaml() will in your case create a class AlbumBase (by default in the subdirectory generated) and an empty class Album extends AlbumBase. I.e. if Album is instantiated AlbumBasemust already been known or loaded by some autoloader.

这篇关于为什么我不能创建一个名为“Album”的Doctrine模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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