I have three tables "category", "product" and "product_category". First two tables are created from two entity Category and Product. Third table "product_category" is auto generated by framework doctrine console command.
Now I can get (fetch) product relational data (based on category id) from below query, which is fine.
$this->createQueryBuilder('p')
->leftJoin('p.category', 'c')
->select('p')
->where('c.id = :category_id')
->setParameter('category_id', 2)
->getQuery()->getSQL();
But how can I use Many-to-Many relation to Update Data? I had Tried with several queries but its not working!!! ( I want to update all product status to inactive (2), whose category status is (2 = Inactive).