symfony - Entity propetytype as object in Symfony2 -
i'm looking information, how use entity propety type object.
i have entity products , categories. in products entity propety category type object. how pass object categories propety? ideas how use? example ?
i say: don't use object type. instead use doctrine's association mappping.
i advice use one-to-many bidirectional or many-to-many bidirectional if want able have 1 product in multiple categories too.
follow these steps:
- place examples in own entity , change annotations @... @orm\...
- generate getters , setters commandline:
app/console doctrine:generate:entities appbundle
- update database schema:
app/console doctrine:schema:update --force
now check created getter , setter functions. might find getproducts() removeproduct() , addproduct().
Comments
Post a Comment