I'm learning how to use Symfony and I have a logical issue.
Here is what I want to do : I have two entities: post and category. Between them, I have a ManyToMany relationship.
Here, everything works as I expected. I have two forms and a relational table between the entities named: post_category
I'd like to give a range for each post which is in a category. So I thought that I have to insert the third column in my relational table.
But here I'm lost. How can I create this? Should I do it manually and create a custom query in a repository?
I never used a custom query yet, so if someone can give some clues to do it...
Thanks a lot!
Here are my (simplified) entities:
class Category
{
private $id;
private $title;
private $description;
private $relPosts;
}
class Post
{
private $id;
private $title;
private $content;
private $slug;
private $relCategories;
private $range;
private $createdAt;
}
My conditional table "post_contenu":
post_id | contenu_id