Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

symfony 4 ? #58

Open
mediafigaro opened this issue Feb 6, 2018 · 5 comments
Open

symfony 4 ? #58

mediafigaro opened this issue Feb 6, 2018 · 5 comments

Comments

@mediafigaro
Copy link

Hello, would this bundle be used with SF4 :/ ?

@silverbackdan
Copy link

I had the same question, I forked and worked on this bundle so that all the tests are passing for me. There is no continuous integration file as far as I can see (e.g. travis) but I've tried to be careful to maintain backwards compatibility except for PHP which had a minimum of 5.3.2 and in my PR has a minimum of 5.5.

I haven't used this updated version myself yet, I'm just about to, but if you'd like to before the conversations are completed and the PR is merged then it is here:
https://github.com/silverbackdan/DoctrineCouchDBBundle

@mediafigaro
Copy link
Author

thanks a lot !!!

@silverbackdan
Copy link

No worries. FYI the bundle does not support the new SF4 file structure. This config will sort the mapping though:

doctrine_couch_db:
    client:
        connections:
            default:
                dbname: products
                host: '%env(COUCHDB_HOST)%'
                user: '%env(COUCHDB_USER)%'
                password: '%env(COUCHDB_PASSWORD)%'
    odm:
        document_managers:
            default:
                mappings:
                    App:
                        type: annotation
                        dir: '%kernel.project_dir%/src/CouchDocument'
                        is_bundle: false
                        prefix: App\CouchDocument
                        alias: App
                auto_mapping: true

@silverbackdan
Copy link

@mediafigaro if you happen to get the annotation mapping working would you be so kind as to reply in #60

I couldn't get it working as suggested either and after the first load I get an error saying the annotation could not be auto-loaded.

If I try XML it's a pain because I don't know the schema and it doesn't look like this bundle or the couchdb-odm has an xsd file in the repo.

@silverbackdan
Copy link

silverbackdan commented Feb 7, 2018

In the Kernel class for now a solution is to:

/// src/Kernel.php
...
    public function boot()
    {
        \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(
            'class_exists'
        );
        return parent::boot();
    }
...

SF4 framework bundle calls this on first load before cached. For more info you can see here:
symfony/symfony#26083

The recommended way of adding annotation support is using methods deprecated in Doctrine anyway so that's probably a separate issue.

As I don't think this is really an issue for SF4 support now, this issue can be closed if the PR is merged and the authors agree.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants