简体   繁体   English

Yii2上使用Gii Generator的数据库异常

[英]Database Exception with Gii Generator on Yii2

First of all, my details(I try to include as much as I can): 首先,我的细节(尽量尽量包括):

PHP 5.6.14 PHP 5.6.14

Oracle DB11G Enterprise Edition 11.2.0.1.0(Installed locally, default localhost setup) Oracle DB11G Enterprise Edition 11.2.0.1.0(本地安装,默认localhost设置)

Windows 7 64-Bit Windows 7 64位

Oci8-2.0.8-5.6-ts-vc11-x86 Oci8-2.0.8-5.6-TS-VC11-86

Yii 2.0.6 Yii 2.0.6

I am trying to use the gii module to generate some models for testing purpose(as I am fairly new to this framework). 我正在尝试使用gii模块生成一些用于测试目的的模型(因为我对这个框架相当新)。 I have imported all the tables/data from my organization's database, and have create related tablespaces and users. 我从组织的数据库中导入了所有表/数据,并创建了相关的表空间和用户。 So my generator have these autocompleted when i typed partial keywords. 因此,当我键入部分关键字时,我的生成器会自动完成这些。

在此输入图像描述

Then when I clicked on preview button, i get this error below 然后,当我点击预览按钮时,我在下面收到此错误

在此输入图像描述

I believe the SYSTEM/SYSAUX are generated automatically when installing the oracle db. 我相信在安装oracle db时会自动生成SYSTEM / SYSAUX。 Plus, the autocomplete tables that appeared when I try to insert the table name is correct and same as the tables i have inside our schema. 另外,当我尝试插入表名时出现的自动完成表是正确的,并且与我在模式中的表相同。 I tried changing the password/creds to be wrong as I cant access the gii page at all(so i believe the connection to my db setup is fine). 我尝试更改密码/信件是错误的,因为我根本无法访问gii页面(所以我相信连接到我的数据库设置很好)。

Can anyone help me. 谁能帮我。 is it a known issue or i am doing something wrong? 这是一个已知问题还是我做错了什么? because as far as I understand, the error shown means that the generator is looking at a different place upon clicking the "preview" button. 因为据我所知,显示的错误意味着点击“预览”按钮后,生成器正在查看其他位置。

Thank you. 谢谢。

** **

UPDATE: New error 更新:新错误

** **

I gave the current user the role of DBA and now it's getting somewhere but I do not understand the cause/errors. 我给了当前用户DBA的角色,现在它已经到了某个地方,但我不明白原因/错误。

在此输入图像描述

ORA-00942: table or view does not exist ORA-00942:表或视图不存在

Looking at the failing SQL, it seems the user which is executing the query doesn't have the DBA privilege to access dba_users and dba_objects . 查看失败的SQL,执行查询的用户似乎没有DBA权限来访问dba_usersdba_objects You need to GRANT the required privilege to this user. 您需要将所需的权限授予该用户。

GRANT DBA to new_user;

I have figured this out. 我已经想到了这一点。 Since my databases and tables are pretty huge, I need to uncheck the "Generate with relations" checkbox. 由于我的数据库和表非常庞大,我需要取消选中“Generate with relations”复选框。

Everything is now working fine. 现在一切都很好。 I am now able to fully utilize the Gii goodness! 我现在能够充分利用Gii的善良!

Anyway I still chose Lalit Kumar's answer since that really helps a lot as it is something that I can't even imagine, thinking it was not something related to the DB. 无论如何,我仍然选择了Lalit Kumar的答案,因为这真的有很大的帮助,因为它是我无法想象的东西,认为它不是与DB相关的东西。 Turns out it is! 结果证明是!

the second error about relations generation is a bug about Yii2, and now have been fixed. 关于关系生成的第二个错误是关于Yii2的错误,现在已经修复了。

Ref: Fixes #166: Fixed "Trying to get property of non-object" during model… 参考:修复#166:修复了模型中“试图获取非对象属性”的问题...

https://github.com/yiisoft/yii2-gii/commit/45696e9f01485799022b0daa56372fc00baece06 https://github.com/yiisoft/yii2-gii/commit/45696e9f01485799022b0daa56372fc00baece06

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM