Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.2.0
-
Fix Version/s: 1.2.2
-
Component/s: Schema Files
-
Labels:None
-
Environment:PHP 5.2.4-2ubuntu5.9 with Suhosin-Patch 0.9.6.2 (cli) (built: Nov 26 2009 14:00:44)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
Oracle database 10gR2
Symfony 1.4.1
Description
Sometimes the ORACLE engine has object names that are not tables, and the doctrine generator tries to
generate classes for them, the following patch solves the problem.
[Solution found thanks to Vladimir Tamara - vtamara AT pasosdejesus DOT org]
diff -u Doctrine/Import/Oracle.php.orig Doctrine/Import/Oracle.php
--- Doctrine/Import/Oracle.php.orig 2010-01-07 17:08:33.000000000
-0500
+++ Doctrine/Import/Oracle.php 2010-01-07 17:08:54.000000000 -0500
@@ -203,7 +203,7 @@
*/
public function listTables($database = null)
{
- $query = "SELECT * FROM user_objects WHERE object_type =
'TABLE'";
+ $query = "SELECT * FROM user_objects WHERE object_type =
'TABLE' and object_name in (select table_name from user_tables)";
return $this->conn->fetchColumn($query);
}
@@ -252,4 +252,4 @@
$query = 'SELECT view_name FROM sys.user_views';
return $this->conn->fetchColumn($query);
}
-}
\ No newline at end of file
+}
Hi Andres.
Bear in mind, that materialized views are also acting like a table. But I think, that they should be imported into doctrine's models too. But I never use an schema Import.
I don't see any differences in the results of both queries.
{{
SELECT * FROM user_objects WHERE object_type = 'TABLE';
SELECT * FROM user_objects WHERE object_type = 'TABLE' and object_name in (select table_name from user_tables)
}}
Both are returning the same resultset. I have only basic objects (tables, views, mviews, some synonyms and some database links). No custom types and so on...
Wouldn't be much better to use only "select table_name from user_tables" ?
I am curious what object types are also acted like a table except mviews. Can you provide more info about your database objects?