thrownew\InvalidArgumentException('Category is not valid');
}
}
Now when I get an existing object of product, $prod_obj->getCategory() should be giving me the category of the product but it’s null. The foreign key relation in the DB isn’t made either. Should I be running any commands after this?
How exactly can I get the category name (let’s say category_name from Category entity) using the $prod_obj? The common link between them is the column – category_id (assume same name in both tables).
I have tested your case, on my side it is working, but i think it is a bit incorrect, because general entity should be Product, but now vice versa. I advise you read these acticles: first and second. They will help you better understand doctrine relations.
We collect cookie information with a goal to provide you with the best user experience. By using this website, you agree to our use of cookies. Read Oro Inc.’s Cookie policy.
We collect cookie information with a goal to provide you with the best user experience. By using this website, you agree to our use of cookies. Read Oro Inc.’s Cookie policy.