pixelfederation / vitess-php-pdo

A pure php implementation of the PDO interface for Vitess (vitess.io)
Apache License 2.0
32 stars 6 forks source link

Class 'Vitess\Proto\Vtrpc\ErrorCode' not found #14

Closed alouane closed 7 years ago

alouane commented 7 years ago

Hi there,

Do you any tip how to fix this class not found error? is there something missing in the project?

From: vendor/vitess/php-client/php/src/Vitess/ProtoUtils.php

Thanks

Rastusik commented 7 years ago

fixed in 0.2.13 - I had to use older vitess php client version

you need to run composer update

alouane commented 7 years ago

I still have the same problem unfortunately

Here is my composer.json: `"minimum-stability": "dev",

"require": {
    "slim/slim": "^3.0",
    "monolog/monolog": "^1.17",
    "vlucas/phpdotenv": "^2.0",
    "symfony/console": "^2.7",
    "vlucas/spot2": "^2.1",
    "tuupola/slim-jwt-auth": "^2.0",
    "tuupola/slim-basic-auth": "^2.0",
    "league/fractal": "^0.13.0",
    "paragonie/random_compat": "^1.2",
    "tuupola/cors-middleware": "^0.5.0",
    "micheh/psr7-cache": "^0.5.0",
    "gofabian/negotiation-middleware": "^0.1.2",
    "tuupola/base62": "^0.7.0",
    "pixelfederation/vitess-php-pdo": "^0.2.13"
},
"autoload": {
    "psr-4": {
        "App\\": "src/App/",
        "Utils\\": "src/Utils/",
        "Doctrine\\DBAL\\Logging\\": "src/Doctrine/DBAL/Logging/",
        "Exception\\": "src/Exception/",
        "Slim\\Handlers\\": "src/Slim/Handlers/"
    }
},
"require-dev": {
    "squizlabs/php_codesniffer": "^2.5",
    "symfony/var-dumper": "^3.0@dev",
    "phpunit/phpunit": "^5.1",
    "squizlabs/php_codesniffer": "2.*",
    "phpmd/phpmd": "@stable"
    },
"config": {
"bin-dir": "bin"
},
"scripts": {
    "test": "composer phplint && composer phpcs",
    "phpcs": "vendor/bin/phpcs --standard=PSR2 --extensions=php --ignore=*/vendor/* . -p",
    "phplint": "env phplint  '**/*.php' '!vendor/**'",
    "watch": "find . -name \"*.php\" -not -path \"./vendor/*\" -o -name \"*.json\" -not -path \"./vendor/*\"| entr -c composer test"
}`

Thanks

Rastusik commented 7 years ago

maybe try to delete the vendor folder and install from scratch?

alouane commented 7 years ago

I juste deleted all vendor's content => composer install, bu I got the same problem, the strange thing though, there is no Vitess\Proto\Vtrpc\ErrorCode classe there, in vendor/vitess/php-client/php/src/Vitess/Proto/Vtrpc folder, there is only: CallerID.php Code.php LegacyErrorCode.php RPCError.php

alouane commented 7 years ago

I tried to call vtgate as a standalone, but I got same problem again Call to undefined method Vitess\VTGateConn::getAttribute()

Definitely something is wrong with the composer auto loading system

Rastusik commented 7 years ago

I'm not sure yet, maybe the vites client is broken, I'll try to fix it, but I can't promise when it will be ready. Anyway, I'll try to do it as quick as possible.

alouane commented 7 years ago

Ok thanks @Rastusik, I'm currently testing a simple php script: $pdo = new VTGateConn(new \Vitess\Grpc\Client('xxxxxxxxxxx.eu-west-1.elb.amazonaws.com:15991', [ 'credentials' => Grpc\ChannelCredentials::createInsecure() ]));

but I got same error: Message: Class 'Vitess\Proto\Vtrpc\ErrorCode' not found File: /var/www/html/RESTFullAPI_2_4/vendor/vitess/php-client/php/src/Vitess/ProtoUtils.php

I'm not sure if it's related to the vitess client dev-master version or something else, but if you can point me out where I can start looking, that would be awesome

Thanks

Rastusik commented 7 years ago

@alouane yes, it's definitely an error in the vitess php client, I got to that conclusion as well, I'll try to fix it from there

alouane commented 7 years ago

Ok thanks for your time Otherwise is it possible to use another version of vitess php client (v2.0.0 fro example), it wouldn't affect the pdo implementation? and what about the minimum-stability, composer is forcing me to set a dev stability, I guess it's because this repo doesn't have a release stable version right?

Rastusik commented 7 years ago

yes it will work, just pick any commit from january 2017 I'd say... anyway I'm going to make a pull request soon for this issue: https://github.com/youtube/vitess/issues/2620

alouane commented 7 years ago

Ok cool But I got this conflict between the 2 versions: vitess-php-pdo requires dev-master version Composer message Can only install one of: vitess/php-client[v2.0.0, dev-master].

Rastusik commented 7 years ago

you can use dev-master#git-commit-hash

Rastusik commented 7 years ago

@alouane but the fix will soon be merged: https://github.com/youtube/vitess/pull/2621

alouane commented 7 years ago

yep I'm following you on vitess repo

Thanks ;)

alouane commented 7 years ago

Check 58 code line https://github.com/youtube/vitess/commit/15235a510e71333c2e6266bcf425f06a2d1226ba#commitcomment-21131018

Rastusik commented 7 years ago

@alouane thanks for the fix :) sorry I was sleeping already :)