yajra / pdo-via-oci8

PHP PDO_OCI functions via OCI8 extension
Other
88 stars 61 forks source link

missing implementation of listTableColumns fail on using laravel-ide-helper #89

Closed mdemori closed 2 years ago

mdemori commented 3 years ago

Summary of problem or feature request

I try to use laravel-ide-helper but when i try to create the model ide-helpers I get and error that error seem related to a query that is used to extract columns notes from db tables.

If I execute the query "manually" from Oracle SQLDeveloper, the query is perfectly valid but don't return any result because my columns don't have any comments.

Below the error message, where DEV_USERS is the real table name and REDACTED_ORACLE_SCHEMA_NAME is the oracle schema where the table is located.

Exception: An exception occurred while executing 'SELECT c.*, ( SELECT d.comments FROM all_col_comments d WHERE d.TABLE_NAME = c.TABLE_NAME AND d.OWNER = c.OWNER AND d.COLUMN_NAME = c.COLUMN_NAME ) AS comments FROM all_tab_columns c WHERE c.table_name = 'DEV_USERS' AND c.owner = 'REDACTED_ORACLE_SCHEMA_NAME' ORDER BY c.column_id':

Argument 1 passed to Doctrine\DBAL\Connection::ensureForwardCompatibilityStatement() must be an instance of Doctrine\DBAL\Driver\ResultStatement, instance of Yajra\Pdo\Oci8\Statement given, called in /mnt/develop/www/acs/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php on line 1314 Could not analyze class App\Models\Article.

Trace:

0 /mnt/develop/www/acs/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(159): Doctrine\DBAL\DBALException::wrapException()

1 /mnt/develop/www/acs/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(2214): Doctrine\DBAL\DBALException::driverExceptionDuringQuery()

2 /mnt/develop/www/acs/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1035): Doctrine\DBAL\Connection->handleExceptionDuringQuery()

3 /mnt/develop/www/acs/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php(168): Doctrine\DBAL\Connection->fetchAllAssociative()

4 /mnt/develop/www/acs/vendor/barryvdh/laravel-ide-helper/src/Console/ModelsCommand.php(432): Doctrine\DBAL\Schema\AbstractSchemaManager->listTableColumns()

5 /mnt/develop/www/acs/vendor/barryvdh/laravel-ide-helper/src/Console/ModelsCommand.php(270): Barryvdh\LaravelIdeHelper\Console\ModelsCommand->getPropertiesFromTable()

6 /mnt/develop/www/acs/vendor/barryvdh/laravel-ide-helper/src/Console/ModelsCommand.php(159): Barryvdh\LaravelIdeHelper\Console\ModelsCommand->generateDocs()

7 /mnt/develop/www/acs/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Barryvdh\LaravelIdeHelper\Console\ModelsCommand->handle()

8 /mnt/develop/www/acs/vendor/laravel/framework/src/Illuminate/Container/Util.php(37): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()

9 /mnt/develop/www/acs/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()

10 /mnt/develop/www/acs/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()

11 /mnt/develop/www/acs/vendor/laravel/framework/src/Illuminate/Container/Container.php(596): Illuminate\Container\BoundMethod::call()

12 /mnt/develop/www/acs/vendor/laravel/framework/src/Illuminate/Console/Command.php(134): Illuminate\Container\Container->call()

13 /mnt/develop/www/acs/vendor/symfony/console/Command/Command.php(256): Illuminate\Console\Command->execute()

14 /mnt/develop/www/acs/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()

15 /mnt/develop/www/acs/vendor/symfony/console/Application.php(971): Illuminate\Console\Command->run()

16 /mnt/develop/www/acs/vendor/symfony/console/Application.php(290): Symfony\Component\Console\Application->doRunCommand()

17 /mnt/develop/www/acs/vendor/symfony/console/Application.php(166): Symfony\Component\Console\Application->doRun()

18 /mnt/develop/www/acs/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run()

19 /mnt/develop/www/acs/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()

20 /mnt/develop/www/acs/artisan(35): Illuminate\Foundation\Console\Kernel->handle()

21 {main}

At first sight I think that is a problem of laravel-ide-helper and I open this ticket to they github, but seem that the problem is related to a missing listTableColumns Here: https://github.com/yajra/pdo-via-oci8/blob/93610843b7abe975413288bcc4adb347edefb4b8/src/Pdo/Oci8/Statement.php#L16

This is the ticket and the reply with some hints to check the problem: https://github.com/barryvdh/laravel-ide-helper/issues/1227

There is a way to solve this problem? I really don't know how to handle it by myself.

System details

Versions: Laravel Version: 7.30.4 PHP Version: 7.4.20 Oracle Laravel - yajra/laravel-oci8 - Version 7.1.1

danielrona commented 2 years ago

This -> https://github.com/barryvdh/laravel-ide-helper/issues/1227#issuecomment-908811646 should solve that.

yajra commented 2 years ago

updating project composer.json from "doctrine/dbal": "^2.5" to "doctrine/dbal": "^3.1" fixed issue for me

Tried and works for me. Thanks!