Managing many-to-many relationship with Breeze - many-to-many

I know that it cannot yet. But having many-to-many is a common thing in my opinion and I would like to ask some suggestions or opinions about the method I follow.
I work on a blog engine where the user can create blog entries and she/he can add multiple tags to it. There are Blog_Entry, Tag and a Blog_Entry_Tag tables. The Blog_Entry table has navigation property to Blog_Entry_Tag table. The Tag table also has navigation property to Blog_Entry_Tag table. Both are one-to many relation. Between Tag and Blog_Entry tables there is no any navigation property. The joining table exposed to Breeze.
When creating and editing new entry the blog entry related data managed separately from the tag related data. At saving I have to manage that the proper data will be inserted into the Blog_Entry_Tag table. The save logic is complicated but managable however, I can't leverage on Breeze great capabilities.
How do you manage situation like this? I know the question might be general, but I went through the available documentation and whatever was displayed in Google without getting closer to the solution or getting even smarter. If you have blogs, examples about this case I really appreciate your help!

Take a look at these two documents, hopefully one of these may offer some help.
http://www.getbreezenow.com/documentation/presenting-many-many
breeze: many-to-many issues when saving

Related

How should I store similar entities - in one table or several?

I am creating a CV website, but in difference to most I am trying to make it with database. I mean that usually such websites are static and all of the information is hard coded in the HTML. Since I am back-end developer I like to make it so everything including buttons and welcome messages are taken from the database. I am trying to store projects that I have worked on. There are several types:
Github Repository - a project that is done purely on github.
Work related - a project I have done on work and there is no github repository of it, only link to view the final result
UpWork or other freelance website - as a freelancer I have projects to fix something on a website and those projects can be viewed only on my profile there and I would like to list them with link to UpWork or wherever there is information on what exactly I was hired to do.
Now my question is - should I have different Entities and therefore different tables for these types of projects or should I have all of the possible properties in one table. For example if it is Github there is repository field and if it is work related then there is company field. If it is freelance it has link to the website I was hired on. Also there are different sub-types - web applications, desktop applications, games and so on.
As you can guess the changes are small (1 or 2 properties). I could very easily leave empty some properties and have another property projectType, but is this the right way? Should I have different tables and entities for them?
To give some info - I can work with both MySQL and NoSQL and I havent decided yet on which one should my website be made on. I am currently thinking about NoSQL. This means I am asking on how to store the projects on MySQL and NoSQL (by NoSQL I mean MongoDB). If it helps the languages I am choosing from are PHP (MySQL) and JavaScript (NoSQL)
I know that usually questions without code are downvoted, but this is more of a logic based problem as I know how to do it, but I don't know the best practices for my situation. This being said here is a small code for you -
console.log('Thank you in advance')
MongoDB lends itself very well to this exact situation.
You can create a collection where documents leave out certain fields if they are not needed for that type. The querying parameters of MongoDB allow you to check $exists on fields if you need to, and documents are stored efficiently, only taking up memory where a field is needed.
You can even setup a sparse index which is not required for every document. As long as your core document structure is the same, it is a good idea to keep them in one collection, and vary them based on their type.

Presentation of a many-to-many relation in web page

Building a library database administration, it has a many-to-many relation (books, writers) and i wonder how to present to the user the management interface.
When editing a book, one must choose writer(s). But how? From a multiple choice drop-down-list? - It would be huge. From a number of drop-down-lists? - hard to control their number and present them in a dedicated module in the page. (Actually the later seems to me a doable solution.)
Any other suggestions? Cheers.
I suggest to use the same way StackOverflow uses to enable you tag multiple technologies while posting a question
It enables you to write the tag manually, and helps you with smart auto complete.
I see this way avoids huge drop down lost and simplifies controlling

Transfer All Custom Field Data From Custom Post Type to User Accounts - Wordpress

Current Situation
I currently have a custom post type. This custom post type has numerous custom fields. There are many posts of this type, all with the custom fields filled out.
Currently, there is ONE POST of this custom post type that corresponds to each author on the blog. No author has more than one of these posts. The method in which it corresponds is simple, they are the author of their own post.
I used the Advanced Custom Fields plugin to set up and manage my custom fields, and I plan to continue doing that.
What I Want to Do
Instead of having these custom fields entered in each author's corresponding post, I would like them to be listed directly in their user meta. I can set up the custom fields easily in there using Advanced Custom Fields, even give them the same names and ids.
The the tricky part would be transferring all this data over. I COULD do it manually, but it would take ages. There is a lot of data to deal with.
Can anyone think of a way to automate this? It might be something as simple as renaming an entire table in the database. I have no idea, I don't know much about mysql databases.
WHY I want to do this, for those interested
Originally I just needed a way to list a bunch of people, and have a bunch of information about them listed on a page. It was not immediately clear to me that these people were all going to be USERS on the site, so at the time it made sense to just make a custom post type, and just enter each person into that with all their meta data.
But then they all became users on the site, and also authors with their own blog posts. And now I need to be able to query meta data about them FROM a blog post. But I can't figure out any way to do that, since their meta data isn't directly connected to their user account. It would appear that it would just be way easier (and more properly done) to tie all that data directly to their account.
Alternate Solution? Might be easier
There could be another way to make this work too. If someone can figure out a way to tie that custom post type post directly to its author, to the extent that you could somehow query it from anywhere as long as you knew which author you were querying, that would work and actually be better.
Possible ways to do that (these are just ideas) could include:
-Manually adding the custom post ID to a custom author meta field, so that you could get the ID of the corresponding post from the author's meta (not ideal, since I would have to enter this manually for every new author)
-That was actually my only idea. I thought of somehow using the username and hoping you can mess with that until you get the corresponding custom post... But there is no way to do that I think without tons of bugs.
Take a look to the excellent Posts 2 Posts plugin. In the official Wiki you can find a specific topic that seems to fit your needs: it's called Posts 2 Users. I hope this will be helpful for you.

hierarchical information in doctrine and symfony 1.4

i have an entity with a lot of fields(like facebook user Information with multiple levels like Basic Information, Contact Information, and...). and i want to use it exactly like facebook . i mean i want several tabs to put related fields in there. the easiest way is to store all of them in a table but it's too nasty . is there any way to do this better? i know something about database hierarchical design, but is there a way to do this in symfony 1.4 and use it's form creator either?
thanks.
First of all: where do you need help? In the view or in the model?
If you want it too look like Facebook, we're talking View. This has nothing to do with Symfony, but just HTML (with some CSS/JS probably).
If you're talking about how to store this information: the information your describing isn't "hierarchical". Hierarchical is about trees and things like that, most of the time with an almost infinite depth.
Here you're talking about a strict structure (you, as developer, know exactly which fields you want to render, and define these yourself). You could look into Entity-Attribute-Value stores. But beware: when implementing some like this in mySQL, it won't be easy to do 'complex' queries. (Even a query like: "List all people in New York, older than 30 years old", is not rendered easy).
So why won't you go with a table with a lot of columns? There's nothing nasty about that! That you, as a human being, may have troubles viewing these data in phpMyAdmin, has nothing to do with how a computer manages this information ;-). You could split up the 'User' model in a seperate 'UserProfile' model (with a one-on-one relation), so you can easily refer to users on other pages (where you don't need all profile data).
You can use Doctrine Nested sets. It is basically a tree structure contained in your database. I have a demo of how this can be used, but the source code might scare you.
Take a look at the demo to give you an idea of what you can do. If you are leaning towards this option, then you should definitely check out the tutorial link I posted below to get started.
Demo
Source Code
Doctrine Nested Sets Documentation
Tutorial on Nested Sets

Loading contents of a webpage into database

I've got several pages about products that I want to load into a database and instead of creating a separate html page for each product, I was thinking of creating a single page that will display whatever product the user clicks on. Each product page will have a similar structure with its name, picture, description, bullet points for features (varies from product to product), price.
My question is if I want to store all those information in a database (I imagine I would need a different field for each paragraph, picture, name, each bullet point, etc) is there a way to get around that? To store all those information in a single field or as few as possible and still keep the formatting. It seems like I would be overloaded with the number of fields I have to manage.
I'm starting to doubt if this was even a good idea to begin with...
Do not store all that information in a single field. If you are going to do that, then just create the HTML page and save yourself the trouble of having a database that you aren't properly utilizing.
What you need to do is identify the relationship between all parts of your page. For example, if a single product can have multiple photos you would want to define a multi table relationship that defines a one-to-many relationship between the Product and ProductImage tables.
Grasping how relational databases relate to the data you are working with can be difficult at first and it might pay off to hire someone for a few hours to go over what you are trying to do and how to implement this effectively using a DB. Since it is a real world example for you it will be an excellent way to learn. Good luck!
You're not the first person to want to do something like this. It's a very common problem that has a well established solution. You need to use what's called a web content management system. WCMSs allow you to use a common template throughout your website while filling in specific stuff for each page. I recommend Joomla because it's easy to setup, easy to use, and most web hosts support it. But you can also look at stuff like Wordpress or Drupal. Wordpress is more blog centric though and Drupal has a steep learning curve.