endyjasmi / neo4j

Neo4j Cypher API for PHP
MIT License
18 stars 7 forks source link

This neo4j returns errors when integrated with laravel 5 #3

Open akulkarni9 opened 9 years ago

akulkarni9 commented 9 years ago

Hi, I installed laravel 5 by using this command:

composer create-project laravel/laravel laravel5test dev-develop

It got installed smoothly without any errors. I went through wiki, added "endyjasmi/neo4j": "2.*" to require section in composer.json, ran composer update. And it was installed successfully, then I added

'EndyJasmi\Laravel\Neo4jServiceProvider'

to providers section in app/config/app.php. I didn't add facades because I don't intend to use them. ( I hope that adding facades is optional! ) Then I went to app/config/database.php, added

/*
    |--------------------------------------------------------------------------
    | Neo4j Databases
    |--------------------------------------------------------------------------
    |
    | Neo4j is an open source graph database which is
    | very fast in traversing related data
    |
    */

    'neo4j' => [
        'default' => 'development',

        'profiles' => [
            'development' => [
                'scheme' => 'http',
                'host' => 'localhost',
                'port' => 7474,
                'username' => '',
                'password' => ''
            ]
        ]
    ]

to connections array. Then I gave default as

'default' => 'development'

Then I thought of testing all those modifications, so I fired up local php server by using

php artisan serve

and this is the error which I got:

exception 'BadMethodCallException' with message 'Call to undefined method [bind]' in /home/ajay/Desktop/laravel5login/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php:221
Stack trace:
#0 /home/ajay/Desktop/laravel5login/vendor/endyjasmi/neo4j/src/Laravel/Neo4jServiceProvider.php(43): Illuminate\Support\ServiceProvider->__call('bind', Array)
#1 /home/ajay/Desktop/laravel5login/vendor/endyjasmi/neo4j/src/Laravel/Neo4jServiceProvider.php(43): EndyJasmi\Laravel\Neo4jServiceProvider->bind('EndyJasmi\Neo4j...', 'EndyJasmi\Neo4j...')
#2 /home/ajay/Desktop/laravel5login/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(415): EndyJasmi\Laravel\Neo4jServiceProvider->register()
#3 /home/ajay/Desktop/laravel5login/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(536): Illuminate\Foundation\Application->register(Object(EndyJasmi\Laravel\Neo4jServiceProvider))
#4 /home/ajay/Desktop/laravel5login/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(518): Illuminate\Foundation\Application->registerDeferredProvider('EndyJasmi\Larav...', 'EndyJasmi\Neo4j...')
#5 /home/ajay/Desktop/laravel5login/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(492): Illuminate\Foundation\Application->loadDeferredProvider('EndyJasmi\Neo4j...')
#6 /home/ajay/Desktop/laravel5login/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(183): Illuminate\Foundation\Application->loadDeferredProviders()
#7 /home/ajay/Desktop/laravel5login/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(89): Illuminate\Foundation\Console\Kernel->bootstrap()
#8 /home/ajay/Desktop/laravel5login/artisan(34): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 {main}

Where did I do mistakes? in app.php? or in database.php? Please help me out

iboldurev commented 5 years ago

I have the same problem

iboldurev commented 5 years ago

I found what the problem, will i add a resolve this problem

open src/Laravel/Neo4jServiceProvider.php Replace 43 line

$this->bind('EndyJasmi\Neo4j\QueryInterface', 'EndyJasmi\Neo4j\Query');

to this

$this->app->bind('EndyJasmi\Neo4j\QueryInterface', 'EndyJasmi\Neo4j\Query');

iboldurev commented 5 years ago

@akulkarni9 resolve to the problem use this in composer.json

"endyjasmi/neo4j": "dev-master#e991f66"