Yii Framework Forum: ORACLE 10g and Yii CLI - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

ORACLE 10g and Yii CLI Rate Topic: -----

#1 User is offline   piwer 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 04-April 09

Posted 29 December 2009 - 02:43 PM

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 ?
0

#2 User is offline   ricardograna 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 376
  • Joined: 31-March 09
  • Location:Manaus/AM - Brazil

Posted 29 December 2009 - 03:59 PM

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.
Yes, It Is!
0

#3 User is offline   litaocug 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-January 10
  • Location:Shanghai, China

Posted 20 January 2010 - 04:00 AM

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
0

#4 User is offline   ricardograna 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 376
  • Joined: 31-March 09
  • Location:Manaus/AM - Brazil

Posted 20 January 2010 - 06:39 AM

View Postlitaocug, on 20 January 2010 - 04:00 AM, said:

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!!
Yes, It Is!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users