ORACLE 10g and Yii CLI

Hello,

I have a table in my ORACLE XE (based on 10g edition) with PK, and some FKs.

The /model/ function of Yii CLI makes the model, but throws some errors:




PHP Warning:  Invalid argument supplied for foreach() in %WWWROOT%\yii\cli\commands\shell\ModelCommand.php on line 158

PHP Stack trace:

PHP   1. {main}() %WWWROOT%\yii\yiic:0

PHP   2. require_once() %WWWROOT%\yii\yiic:15

PHP   3. CApplication->run() %WWWROOT%\yii\yiic.php:31

PHP   4. CConsoleApplication->processRequest() %WWWROOT%\yii\base\CApplication.php:135

PHP   5. CConsoleCommandRunner->run() %WWWROOT%\yii\console\CConsoleApplication.php:88

PHP   6. ShellCommand->run() %WWWROOT%\yii\console\CConsoleCommandRunner.php:62

PHP   7. ShellCommand->runShell() %WWWROOT%\yii\cli\commands\ShellCommand.php:99

PHP   8. ModelCommand->run() %WWWROOT%\yii\cli\commands\ShellCommand.php:144

PHP   9. ModelCommand->generateRelations() %WWWROOT%\yii\cli\commands\shell\ModelCommand.php:294



Line 158 of ModelCommand.php is:


foreach ($table->foreignKeys as $fkName => $fkEntry)

so i suppose command doesn`t recognize foreign keys?

The same is with tables that were created for tests by installer of ORACLE and mine, so i suppose it can be bug?

Is it a bug, or i do something wrong ?

since “generateRelations” method was introduced, it doesn’t work well with Oracle (had not time yet to fix this). What I use to do is to comment the call to generateRelations at ModelCommand.

The only problem with this is that Yii will not autogenerate relations, but everything else will work properly.

Must be a case sensitive problem.

Modify yii\framework\db\schema\oci\COciSchema.php, from line 268,

change




		foreach($rows as $row)

		{

			if($schema===$this->getDefaultSchema())

				$names[]=$row['table_name'];

			else

				$names[]=$row['schema_name'].'.'.$row['table_name'];

		}



to




		foreach($rows as $row)

		{

			if($schema===$this->getDefaultSchema())

				$names[]=$row['TABLE_NAME'];

			else

				$names[]=$row['SCHEMA_NAME'].'.'.$row['TABLE_NAME'];

		}



test environment: windows xp sp3 + php 5.3.1 + yii-1.1.0.r1700 + oracle 10

You are absolutely sure! Don’t know how I haven’t seen this!!