For further actions, you may consider blocking this person and/or reporting abuse
For further actions, you may consider blocking this person and/or reporting abuse
Hassan Sani -
Prasanna -
Ben Halpern -
Ben Halpern -
Once suspended, mah3uz will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, mah3uz will be able to comment and publish posts again.
Once unpublished, all posts by mah3uz will become hidden and only accessible to themselves.
If mah3uz is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Mahfuz Shaikh.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community š©āš»šØāš» safe. Here is what you can do to flag mah3uz:
Unflagging mah3uz will restore default visibility to their posts.
Top comments (2)
One to many: For example a blog post and comments.
Every blog post can have many comments but each comment only belongs to one blog post.
The way this is implemented is by giving every comment a
blog_post_id
so you can query the database for every comment with ablog_post_id
that equal's the blog post'sid
.Many to many: For example tags on a blog post.
Every blog post can have many tags (this one, for example, has two; #orm and #explainlikeimfive), and every tag can be attached to many blog posts (searching #explainlikeimfive will bring up many posts).
This cannot be implemented by adding a
blog_post_id
attribute to tags, because every tag needs to be able to have manyblog_post_id
s, instead, it's implemented using a join table.A join table is a table that has two columns,
blog_post_id
andtag_id
. Every time you want to add a tag to a blog post you add an entry to the join table with the id of the blog post and the id of the tag. Getting a list of all the tags that were applied to a given article is done by querying the join table for all of thetag_id
s where theblog_post_id
matches your blog post and vice versa for getting a list of all of the articles with a given tag.This is a very nice answer! I'd just add that in the 'Object' part of ORM, the usage is usually pretty simple. For example, something like
blog_post.tags
will get the tags associated with a blog post andtag.blog_posts
will get the blog posts associated with a given tag.Behind the scenes the ORM will use its mapping configuration to retrieve these associations from a relational database. That's where a join table is probably going to be used to represent a many-to-many relationship between two tables, e.g. there would be something like an
X_BLOG_POST_TAG
table that connects theBLOG_POST
andTAG
tables. However, in your domain code, you usually won't need to be aware of this, which of course is the whole point behind object-relational mapping.