installation of the bundle.... #1

Closed
jamhall opened this Issue Jul 14, 2011 · 18 comments

Projects

None yet

4 participants

@jamhall
jamhall commented Jul 14, 2011

Hi all,

I wish to install the bundle into my symfony project. However, I am coming across a few issues. Please accept my ignorance if the answer is trivial but I've tried searching for a solution butm alas, I've found nothing.

In my deps file, I have:

[doctrine-couchdb]
  git=http://github.com/doctrine/couchdb-odm.git
[DoctrineCouchDBBundle]
  git=http://github.com/doctrine/DoctrineCouchDBBundle.git
  target=/bundles/Symfony/Bundle/DoctrineCouchDBBundle

I run the bin/vendors install* command

In my **autoload.php* file I have:

     'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib',

I've registered the bundle:

new Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle()

When I run php app/console I get the error:

Fatal error: Class 'Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle' not found in /var/www/symfony2.test/app/AppKernel.php on line 22

I've noticed that for MongoDB ODM you have:

[doctrine-mongodb]
    git=http://github.com/doctrine/mongodb.git

is there not a doctrine-couchdb repo?

Thanks for any help! and thank you for your hard work.

Jamie

@beberlei
Member

Hi,

You almost have the right cnofiguratino: Your autoload needs one more paths. You need to autoload Doctrine\ODM\ and Doctrine\Bundle\CouchDBBundle. Both are in different folders.

@beberlei
Member

Btw, i am not sure if the Annotation driver already works with the new annotation 2.1 syntax. I will check in some minutes and probably adjust it to work then.

@jamhall
jamhall commented Jul 14, 2011

Hey berblei, thank you for the prompt response, I managed to get the answer: http://stackoverflow.com/questions/6691954/installation-of-a-symony2-bundledoctrinecouchdbbundle/6692010#6692010

However, i've run into another problem (heh),

  [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]        
  You have requested a non-existent service "doctrine_couchdb.client._connection".

config.yml:

doctrine_couch_db:
  client:
    dbname: symfony2
  odm:
    auto_mapping: true

@beberlei
Member

hm try explicitly naming the connections client: default: dbname and odm: default: auto_mapping...

@jamhall
jamhall commented Jul 14, 2011

I did what you said:

doctrine_couch_db:
  client:
    default_connection:
        database: symfony2
  odm:
    auto_mapping: true
  [InvalidArgumentException]                               
  'dbname' is a required option to create a CouchDBClient

I appreciate that it's ALPHA so i'm not getting too annoyed :-) Learning lots on the way....

@beberlei
Member

Ah no, let me format it correctly that way its clearer:

doctrine_couch_db:
  client:
    default_connection: default
    default:
        dbname: symfony2
  odm:
    default_document_manager: default
    default:
        auto_mapping: true
@ghost
ghost commented Sep 12, 2011

Followed instructions above, with no success, problem loading the following in AppKernel:

new Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle()

even though my registered namespaces appears to be correct to the best of my knowledge

'Doctrine\\Bundle\\CouchDBBundle'=> __DIR__.'/../vendor/bundles'
'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib'
'Doctrine\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib'

dependency configuration is as follows:

[doctrine-couchdb]
  git=http://github.com/doctrine/couchdb-odm.git
  
[DoctrineCouchDBBundle]
  git=http://github.com/doctrine/DoctrineCouchDBBundle.git
  target=/bundles/Doctrine/Bundle/DoctrineCouchDBBundle

Error Displayed:

Fatal error: Class 'Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle' not found in /Volumes/D/Development/web/client/jammer-gammer/app/AppKernel.php on line 17
@ghost
ghost commented Sep 12, 2011

I changed target to target= /bundles/Doctrine/Bundle/CouchDBBundle

so now looks like this

[DoctrineCouchDBBundle]
  git=http://github.com/doctrine/DoctrineCouchDBBundle.git
  target=/bundles/Doctrine/Bundle/CouchDBBundle

because I noticed that name space for couchdb bundle isnamespace Doctrine\Bundle\CouchDBBundle; therefore adding new Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle() to AppKernel will fail, if installation location does not match namespace/class_name.

@ghost
ghost commented Sep 12, 2011

For configurations I had issues using information provided above, but changing it to the following worked or rather exceptions were no long throw.

doctrine_couch_db:
  client:
    default_connection: default
    dbname: name_for_couchdb_database
    
  odm:
    default_document_manager: default

Not sure if I was done something wrong but the configuration below fails with all sorts of exceptions

doctrine_couch_db:
  client:
    default_connection: default
    default:
        dbname: symfony2
  odm:
    default_document_manager: default
    default:
        auto_mapping: true
@ghost
ghost commented Sep 12, 2011

Success, my couchdb connection works now. The following code:

        $client = $this->container->get('doctrine_couchdb.client.default_connection');
        $documentManager = $this->container->get('doctrine_couchdb.odm.default_document_manager');

in controller works 100% and I can even see couchdb Symfony development bar icon and view:

Happy days :)

@stof
Member
stof commented Sep 12, 2011

The expanded version of the configuration is

doctrine_couch_db:
  client:
    default_connection: default
    connections:
        default:
            dbname: symfony2
  odm:
    default_document_manager: default
    document_managers:
        default:
            auto_mapping: true
@ghost
ghost commented Sep 12, 2011

@stof :Thanks, that works as expected.

@ghost
ghost commented Sep 13, 2011

For those that are new to Symfony 2 bundling architecture, you probably wonder what configuration keys are mandatory and available for bundles. Info can be obtained from: bundle_dir/bundle_name/.../configuration.php

@ghost
ghost commented Sep 13, 2011

@beberlei:

I'm currently experiencing issues whiles loading document class 0_o, detailed info here doctrine/couchdb-odm#22 (comment) "Avoiding Duplication"

After running a few traces and debugging, it is now apparent that the DriverChain namespace Doctrine\ODM\CouchDB\Mapping\Driver has no drivers loaded. Even through is seems that drivers have been configured in the bundle configuration Resources/config/odm.xml

  1. where in the code are these injected?
  2. are drivers explicitly activated through config.yml
  3. does anyone have working example/application using doctrine couchdb bundle?
@godbout
godbout commented Dec 9, 2011

i'm having a hard time to make this work...

I had the same issue as Flukey with the
Fatal error: Class 'Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle' not found in /var/www/symfony2.test/app/AppKernel.php on line 22
but it seems ok now.

in my autoloading i have:
'Doctrine\\CouchDB' => __DIR__.'/../vendor/doctrine-couchdb-odm/lib', 'Doctrine\\ODM\\CouchDB' => __DIR__.'/../vendor/doctrine-couchdb-odm/lib', 'Doctrine\\Bundle' => __DIR__.'/../vendor/bundles',

but now i end up having the following error message:
Fatal error: Class 'Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\DoctrineValidationPass' not found in /Users/guill/Development/sensornet/vendor/bundles/Doctrine/Bundle/CouchDBBundle/DoctrineCouchDBBundle.php on line 30
and yes, I don't have a DependencyInjection folder where needed.
Any tip?

@godbout
godbout commented Dec 9, 2011

alirght, i reverted to tag 2.0 and i don't have the issue anymore. guess there's a bug somewhere?

@stof
Member
stof commented Dec 9, 2011

The master branch of the bundle requires Symfony master.

@godbout
godbout commented Dec 9, 2011

well, that does make sense. I actually just realized the versioning in the deps file when I reversed to 2.0. smart way to handle versioning but I'm just starting with symfony2 and the doc didn't help me much on that. Thx anyway, appreciate the answer.

@stof stof closed this Feb 12, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment