Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add DoctrineMongoDBBundle recipe #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed

Add DoctrineMongoDBBundle recipe #10

wants to merge 4 commits into from

Conversation

Lctrs
Copy link
Contributor

@Lctrs Lctrs commented May 2, 2017

No description provided.

@@ -0,0 +1,18 @@
doctrine_mongodb:
auto_generate_proxy_classes: "%kernel.debug%"
auto_generate_hydrator_classes: "%kernel.debug%"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest using single quotes. Double quotes in YAML require escaping lots of things.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the officiel recipe for doctrine/doctrine-bundle, we use double quotes for this parameter.

See https://github.com/symfony/recipes/blob/master/doctrine/doctrine-bundle/1.6/etc/packages/doctrine.yaml#L5.

is_bundle: false
type: annotation
dir: "%kernel.project_dir%/src/Document"
prefix: "App\\Document\\"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We often voluntarily remove quotes for class names and would just use prefix: App\Document\ in this case, it should work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not inline with the official Doctrine ORM recipe.

"src/": "%SRC_DIR%/"
},
"env": {
"MONGODB_URL": "mongodb://localhost:27017",
Copy link
Contributor

@Pierstoval Pierstoval May 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the other constant and suffix it to the url to keep consistency with Doctrine ORM recipe and then simply have
"MONGODB_URL": "mongodb://localhost:27017/symfony", ?

@Lctrs
Copy link
Contributor Author

Lctrs commented May 2, 2017

One thing I don't know how to translate is the 2 lines that we needed to add to the old app/autoload.php (see the docs for the lines in question). Any idea ?

@Pierstoval
Copy link
Contributor

The ORM annotation driver was lazy-loaded in symfony/symfony#21837, maybe something similar could be done for the ODM, I don't know 😕

@stof
Copy link
Member

stof commented May 3, 2017

Actually, as the ODM bundle uses the annotation_reader defined by Symfony, it automatically benefits from the change done in Symfony (as long as the ODM annotations are autoloadable, but I think they are).

@Lctrs
Copy link
Contributor Author

Lctrs commented May 3, 2017

Yeah. I tested it in a fresh application and it works as expected.

@Lctrs
Copy link
Contributor Author

Lctrs commented May 3, 2017

Should be good now.

@fabpot
Copy link
Member

fabpot commented May 3, 2017

Thank you @Lctrs.

@fabpot fabpot closed this in b165dcd May 3, 2017
@Lctrs Lctrs deleted the feature/doctrine-mongodb-odm-bundle branch May 3, 2017 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants