Laravel-ide-helper: MS SQL issues

Created on 30 Jan 2017  路  10Comments  路  Source: barryvdh/laravel-ide-helper

Hi, I wanted to use "ide-helper:models" with "sqlsrv" driver, I run MS Sql server for my database. But I get following error for each model:

Exception: SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute
Could not analyze class App\SomeModel

stale

Most helpful comment

The problem is a bit deeper (DBAL, it's own descendants of PDO etc). It also crushes DBAL-based model generators.
For me the solution was enabling persistent connections, basic PDO is used then.

config/database.php:

'connections' => [
    'sqlsrv' => [
        'driver' => 'sqlsrv',
        // ...
        'options' => [\PDO::ATTR_PERSISTENT => true],
    ],
],

Can be done for local environment only if necessary:

$pdoOptions = [];
if (env('APP_ENV') == 'local') {
    $pdoOptions[\PDO::ATTR_PERSISTENT] = true;
}
// ...
return [
    'connections' => [
        'sqlsrv' => [
            'driver' => 'sqlsrv',
            // ...
            'options' => $pdoOptions,
        ],
    ],
];

All 10 comments

Yeah, got same trouble. My new project needs to work with MSSQL, if this package could support model generation for MSSQL, that would be awesome.

Sorry don't have MSSQL. I'm using Doctrine to generate it. If you can submit a PR that would be great.

Thanks for let us know. I'll take a look about how it works in raw first then will try to make a PR. Great package btw

Any work being done on this issue? I'm also on MSSQL and can't generate phpdocs for models.

The problem is a bit deeper (DBAL, it's own descendants of PDO etc). It also crushes DBAL-based model generators.
For me the solution was enabling persistent connections, basic PDO is used then.

config/database.php:

'connections' => [
    'sqlsrv' => [
        'driver' => 'sqlsrv',
        // ...
        'options' => [\PDO::ATTR_PERSISTENT => true],
    ],
],

Can be done for local environment only if necessary:

$pdoOptions = [];
if (env('APP_ENV') == 'local') {
    $pdoOptions[\PDO::ATTR_PERSISTENT] = true;
}
// ...
return [
    'connections' => [
        'sqlsrv' => [
            'driver' => 'sqlsrv',
            // ...
            'options' => $pdoOptions,
        ],
    ],
];

@DarthMuto Did you manage to make it work?

Yep, works fine.
However, it's not a fix for the problem, it's a way to avoid problem.

Is this issue solved? I tried @DarthMuto 's method, but got this exception:
Exception: SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS cannot be used with persistent PDO instances

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.

The problem is a bit deeper (DBAL, it's own descendants of PDO etc). It also crushes DBAL-based model generators.
For me the solution was enabling persistent connections, basic PDO is used then.

config/database.php:

'connections' => [
    'sqlsrv' => [
        'driver' => 'sqlsrv',
        // ...
        'options' => [\PDO::ATTR_PERSISTENT => true],
    ],
],

Can be done for local environment only if necessary:

$pdoOptions = [];
if (env('APP_ENV') == 'local') {
    $pdoOptions[\PDO::ATTR_PERSISTENT] = true;
}
// ...
return [
    'connections' => [
        'sqlsrv' => [
            'driver' => 'sqlsrv',
            // ...
            'options' => $pdoOptions,
        ],
    ],
];

Still seeing this issue, and the above patch was not a fix for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hatamiarash7 picture hatamiarash7  路  3Comments

neeravp picture neeravp  路  3Comments

Newbie012 picture Newbie012  路  4Comments

beniaminorossini picture beniaminorossini  路  5Comments

half-evil picture half-evil  路  3Comments