Use of symfony2 mongodb
PHP中文网
PHP中文网 2017-05-16 16:44:45
0
1
512

I was reading the symfony2 mongodb documentation recently, and I felt a little confused about how to use it.

Mongodb has odm one-to-one, one-to-many, many-to-many relationship mapping similar to mysql orm, which is also more convenient to use.

But if you use mysql and mongodb in combination, to get the mongodb data from mysql, according to the doctrine one-to-one official document, you need to associate mysql and mongodb through the subscriber and LifecycleEventArgs events.
There are no detailed examples for one-to-many and many-to-many. Later, it was discovered that when using one-to-many and many-to-many, an intermediate table needs to be generated in mysql and mongodb. Through the LifecycleEventArgs event, the intermediate table becomes a bridge for communication between mysql and mongodb

So the maintenance of this intermediate table is more troublesome. For example, if you delete mongodb data, you must also update the intermediate table. In addition, if there are many tables associated with two databases, wouldn't there also be many intermediate tables? ?

For smyfony2, use MySQL and mongodb in combination. Is it better to use a single database? ? ? If the two are used in combination, the stored data must not be highly dependent? ? ? In that case, does it feel cumbersome to use mysql and mongodb on the doctrine official website? ?

PHP中文网
PHP中文网

认证0级讲师

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!