Database/Code solutions for model with dynamic data, using Symfony 2 with Doctrine -
i'm making application symfony2 , doctrine , i'm facing problem i've wondered it's never been issue until today: how handle dynamic data?
in application i'm developing there data might relational , relational database features might useful , other data structure can dynamic , don't care querying , indexing, long it's stored , linked other relational data, example:
- a user linked other users through "friendship" relation
- a user can create documents fields can changed dinamically type-wise , must linked user created them
the best way make example compare drupal, can create own content types , define fields inside each content type (but content of type have same data, though can dinamically changed without altering code)
i don't want use drupal though, application have in mind complicated drupal (probably -a lot- of tweaks, -a lot- of modules , code edits, rather avoid, might similar result drupal, rather start scratch using symfony bending drupal will, thought of gives me shivers).
back question. have started studying problem , thinking no-sql solution mongodb, after reading around bit felt needed direction point reasearch in particular when ended reading http://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/ , scared me bit. haven't ended research yet post made me lose hope bit , made me decide ask here in advance, hoping maybe has faced problem , found working , tested solution (which i'd use rather making untested 1 myself). issue can split in 2 parts:
1) database
the solutions came with, still little knowledge, are:
- relational database (mysql or postgres, i'm thinking second since has json support) tables dynamic content have text/longtext/json (in case of postgres) field contain json object containing data
- drupal-like solution each field mapped new table (i don't it, i'm adding completeness sake)
- hybrid solution: relational data in relational database, dynamic data in no-sql database fields (say, user_id, foreign key like) connect 2 things
- full no-sql solution: use mongodb (but i'd reassured issues mentioned in post above), or else...i'm open suggestions (as long can used symfony , doctrine)
2) code
i haven't yet investigated code part since have adapt database solution i'll use, aware doctrine has odm handle data mongodb database. don't know if it's possibile use both orm , odm @ same time , make them communicate it.
in case of #1 shouldn't hard, doctrine create array data , i'll able retrieve through function.
issue might have forms regarding data, haven't investigated yet
i aware symfony 2 cmf project might ideas http://cmf.symfony.com/ after looking around bit felt needed directions on issue
so kept searching , found this: mix of mysql , mongodb in application hstore field got interest.
looking further have discovered extension add hstore support on doctrine , symfony https://github.com/intaro/hstore-extension , looks it's need.
in alternative can use jsonb (still postgres) looks powerful tool dynamic models, support being introduced in doctrine , can wait until then
Comments
Post a Comment