.. rst-class:: outdated Categorization ============== .. danger:: We're sorry but **this documentation section is outdated**. Please have that in mind when trying to use it. You can help us making documentation up to date via Sylius Github. Thank you! In this example, we will use taxonomies to categorize products and build a nice catalog. We think that **keeping the app-specific bundle structure simple** is a good practice, so let's assume you have your ``ShopBundle`` registered under ``Acme\ShopBundle`` namespace. .. code-block:: php taxons = new ArrayCollection(); } public function getTaxons() { return $this->taxons; } public function setTaxons(Collection $taxons) { $this->taxons = $taxons; } } You also need to define the doctrine mapping with a many-to-many relation between Product and Taxons. Your product entity mapping should live inside ``Resources/config/doctrine/Product.orm.xml`` of your bundle. .. code-block:: xml Product is just an example where we have many to many relationship with taxons, which will make it possible to categorize products and list them by taxon later. You can classify any other model in your application the same way. Creating your forms ------------------- To be able to apply taxonomies on your products, or whatever you are categorizing or tagging, it is handy to use `sylius_taxon_choice` form type: .. code-block:: php add('taxons', 'sylius_taxon_choice'); } public function configureOptions(OptionsResolver $resolver) { $resolver ->setDefaults(array( 'data_class' => 'Acme\ShopBundle\Entity\Product' )) ; } } This `sylius_taxon_choice` type will add a select input field for each taxonomy, with select option for each taxon.