sylius_admin_taxon:
    resource: |
        alias: sylius.taxon
        section: admin
        templates: "@SyliusAdmin\\shared\\crud"
        except: ['show', 'index']
        redirect: update
        permission: true
        form:
            type: Sylius\Bundle\AdminBundle\Form\Type\TaxonType
    type: sylius.resource

sylius_admin_taxon_index:
    path: /taxons/
    methods: [GET]
    defaults:
        _controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
        route: sylius_admin_taxon_create
        permanent: true

sylius_admin_taxon_create_for_parent:
    path: /taxons/new/{id}
    methods: [GET, POST]
    defaults:
        _controller: sylius.controller.taxon::createAction
        _sylius:
            section: admin
            permission: true
            template: '@SyliusAdmin/shared/crud/create.html.twig'
            redirect: sylius_admin_taxon_update
            form:
                type: Sylius\Bundle\AdminBundle\Form\Type\TaxonType
            factory:
                method: createForParent
                arguments: ['expr:notFoundOnNull(service("sylius.repository.taxon").find($id))']
