I load some product catalogs into database. And i want to load each catalog (xml file) into new separate table in the database, because each catalog can contain 1 000 000 products. So, i need dynamic table name for entity and connection for entity manager also can be random. For web requests (display these products in browser) metadata for entity must be cached after catalog loaded and activated for web.
In my implementation it looks something like this: Table entity contains entity class name and currently active version Table entity_table contains table name, connection name, entity id (from entity table), version id. As i understand, i need to extend class ORM\Mapping\Driver\AnnotationDriver (i use annotations in the entity classes) for change table name to table name from active version using tables above. In this case metadata cache will work good. Then, if i change active version, i just need clear and warmup metadata cache. Then each EntityManager have MetadataFactory and i need to extend standard MetadataFactory (or decorate them with wrapper) and change method isTransient to check connection name before calling my extended AnnotationDriver->isTransient(). Background tasks will use other metadata, because they can work with any version of catalog (not only active version like in web requests). For them i need to change my extended AnnotationDriver to use version id (or just table name), which i define outside of them. Also i need to turn off caching in MetadataFactory. Will this work? What i need to know more about Doctrine and these factories and drivers? May be exist more simple solution, for example, just to change some settings in database configuration to use my connection configuration (some classes, which uses tables above to return configuration for doctrine)? -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
