I am trying to insert a many to many relation in my symfony2 project.
I have followed all steps from Symfony2-Doctrine: ManyToMany relation is not saved to database
ALL records are entered in items table except category_id…
Any idea ???
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s because category_id shouldn’t be in items table but in items_categories table (it’s many to many relation so Doctrine will create third table to achieve this)
You specify $categories field in your Item entity (Doctrine doesn’t create any additional column like category_id). category_id is database concept. On ORM level you don’t use columns – you just use entity properties