Coder Social home page Coder Social logo

Comments (7)

Koc avatar Koc commented on May 29, 2024

Also names of connections may be not equal to names of entity managers

from stofdoctrineextensionsbundle.

stof avatar stof commented on May 29, 2024

Doctrine event managers are attached to the DBAL connections, not to the entity manager. So the name in the bundle config for the ORM is the name of the DBAL connection as stated in the doc.

And btw, your ORM config is bad. You should not register the same bundles for both entity managers as an entity cannot be managed by several entity managers (they would not share the changes done on the entities as they use separate UnitOfWork and so retrieving the same entity from both entity managers would give you different objects, which each one their changes and then a broken state when flushing.

from stofdoctrineextensionsbundle.

Koc avatar Koc commented on May 29, 2024

Ok, I've understood my problem.

You should not register the same bundles for both entity managers

Whan you can advice for me? FooTerritorialBundle should have access to both connections.

from stofdoctrineextensionsbundle.

stof avatar stof commented on May 29, 2024

You need to separate the entities managed by both entity managers to different namespaces (as Doctrine registers the mapping by a folder). If you really need to put them in the same bundle, you will need to use different folders and register the mapping explicitly instead of relying on the auto-detection

from stofdoctrineextensionsbundle.

stof avatar stof commented on May 29, 2024

ah, and btw, you don't have 2 connections but 2 entity managers sharing the same DBAL connections (and so the same database). I don't really see the use case for such setup as this could be achieved using a single entity manager for the whole database, and it would probably be more efficient and easier to use.

from stofdoctrineextensionsbundle.

Koc avatar Koc commented on May 29, 2024

you don't have 2 connections but 2 entity managers sharing the same DBAL connections

This is for dev env only. In production there are 2 different DBAL connections.

from stofdoctrineextensionsbundle.

Koc avatar Koc commented on May 29, 2024

I've created two entity managers for replication: one connection for writing and some connection for writing. In dev env. only one connection shared between this two entity managers.

Sometimes I'm getting error message "Tree object class: UserArea must have tree metadata at this point" when getting user. When I change entity manager for getting this entity - it works correct.

AbstractArea - closure tree + STI
User has one UserArea
UserArea has one User and one child of AbstractArea.

What you can advice to me?

from stofdoctrineextensionsbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.