制作Sylius插件:找不到" GET / admin / seller /"

时间:2017-12-12 13:42:34

标签: symfony sylius

我试图在Sylius中为实体卖家管理定义路由。 当我尝试访问页面http://127.0.0.1:8000/admin/sellers/时,我发现了这些错误:

  

Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException:无路由   找到" GET / admin / sellers /"

     


  /home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php:139   在   的Symfony \组件\ HttpKernel \事件监听\ RouterListener-> onKernelRequest(对象(GetResponseEvent),   ' kernel.request',对象(TraceableEventDispatcher))at   call_user_func(array(object(RouterListener),' onKernelRequest'),   object(GetResponseEvent),' kernel.request',   对象(TraceableEventDispatcher))        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php:104)   在   的Symfony \组件\此事件\调试\ WrappedListener-> __调用(对象(GetResponseEvent),   ' kernel.request',object(ContainerAwareEventDispatcher))        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:212)   在   的Symfony \组件\此事件\ EventDispatcher-> doDispatch(阵列(对象(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener)),' kernel.request',   对象(GetResponseEvent))        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:44)   在   的Symfony \组件\此事件\ EventDispatcher->调度(' kernel.request&#39 ;,   对象(GetResponseEvent))        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:139)   在   的Symfony \组件\此事件\调试\ TraceableEventDispatcher->调度(' kernel.request&#39 ;,   对象(GetResponseEvent))        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:129)   在Symfony \ Component \ HttpKernel \ HttpKernel-> handleRaw(object(Request),   1)        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)   在Symfony \ Component \ HttpKernel \ HttpKernel->句柄(对象(请求),1,   真正)        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:202)   在Symfony \ Component \ HttpKernel \ Kernel->句柄(对象(请求))        (web / app_dev.php:16)at require(' /home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/tests/Application/web/app_dev.php')        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php:42)

  

的Symfony \元器件\路由\异常\ ResourceNotFoundException:

     


  /tmp/a99a18f5531c358fe4a7a5bc81471b03/cache/appDevDebugProjectContainerUrlMatcher.php:3988   在appDevDebugProjectContainerUrlMatcher->匹配(' / admin / sellers /')        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php:95)   在   的Symfony \组件\路由\匹配器\ UrlMatcher-> matchRequest(对象(请求))        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/Routing/Router.php:262)   在Symfony \ Component \ Routing \ Router-> matchRequest(object(Request))        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php:109)   在   的Symfony \组件\ HttpKernel \事件监听\ RouterListener-> onKernelRequest(对象(GetResponseEvent),   ' kernel.request',对象(TraceableEventDispatcher))at   call_user_func(array(object(RouterListener),' onKernelRequest'),   object(GetResponseEvent),' kernel.request',   对象(TraceableEventDispatcher))        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php:104)   在   的Symfony \组件\此事件\调试\ WrappedListener-> __调用(对象(GetResponseEvent),   ' kernel.request',object(ContainerAwareEventDispatcher))        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:212)   在   的Symfony \组件\此事件\ EventDispatcher-> doDispatch(阵列(对象(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener)),' kernel.request',   对象(GetResponseEvent))        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:44)   在   的Symfony \组件\此事件\ EventDispatcher->调度(' kernel.request&#39 ;,   对象(GetResponseEvent))        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:139)   在   的Symfony \组件\此事件\调试\ TraceableEventDispatcher->调度(' kernel.request&#39 ;,   对象(GetResponseEvent))        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:129)   在Symfony \ Component \ HttpKernel \ HttpKernel-> handleRaw(object(Request),   1)        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)   在Symfony \ Component \ HttpKernel \ HttpKernel->句柄(对象(请求),1,   真正)        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:202)   在Symfony \ Component \ HttpKernel \ Kernel->句柄(对象(请求))        (web / app_dev.php:16)at require(' /home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/tests/Application/web/app_dev.php')        (/home/robomatix/www/html_local/Artaban/SyliusSimpleMarketplacePlugin/vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php:42)

抱歉,我无法使用代码实现......

这是我的代码:

Artaban / SyliusSimpleMarketplacePlugin / SRC /资源/配置/ config.yml

imports:
    - { resource: 
 "@ArtabanSyliusSimpleMarketplacePlugin/Resources/config/services.yml" 
}
- { resource: 
"@ArtabanSyliusSimpleMarketplacePlugin/Resources/config/resources.yml" 
}
- { resource: "@ArtabanSyliusSimpleMarketplacePlugin/Resources/config/grids/grids.yml" 
}

Artaban / SyliusSimpleMarketplacePlugin / SRC /资源/配置/ resources.yml

sylius_resource:
    resources:
        app.seller:
            driver: doctrine/orm # You can use also different driver here
            classes:
                model: Artaban\SyliusSimpleMarketplacePlugin\Entity\ArtabanSimpleMarketplace_Seller

Artaban / SyliusSimpleMarketplacePlugin / SRC /资源/配置/网格/管理/ seller.yml

 sylius_grid:
grids:
    app_admin_seller:
        driver:
            name: doctrine/orm
            options:
                class: Artaban\SyliusSimpleMarketplacePlugin\Entity\ArtabanSimpleMarketplace_Seller
        fields:
            name:
                type: string
                label: sylius.ui.name
            description:
                type: string
                label: sylius.ui.description
            enabled:
                type: twig
                label: sylius.ui.enabled
                options:
                    template: "@SyliusUi/Grid/Field/enabled.html.twig"
        actions:
            main:
                create:
                    type: create
            item:
                update:
                    type: update
                delete:
                    type: delete

Artaban / SyliusSimpleMarketplacePlugin / SRC /资源/配置/网格/ grids.yml

imports:
- { resource: '@ArtabanSyliusSimpleMarketplacePlugin/Resources/config/grids/admin/seller.yml' }

Artaban / SyliusSimpleMarketplacePlugin / SRC /资源/配置/路由/管理/ seller.yml

app_admin_seller:
resource: |
    alias: app.seller
    section: admin
    templates: SyliusAdminBundle:Crud
    redirect: update
    grid: app_admin_seller
    vars:
        all:
            subheader: app.ui.seller
        index:
            icon: 'file image outline'
type: sylius.resource

Artaban / SyliusSimpleMarketplacePlugin / SRC /资源/配置/路由/ admin.yml

app_admin_seller:
resource: '@ArtabanSyliusSimpleMarketplacePlugin/Resources/config/routing/admin/seller.yml'

Artaban / SyliusSimpleMarketplacePlugin / SRC /资源/配置/ routing.yml中

app_admin:
resource: '@ArtabanSyliusSimpleMarketplacePlugin/Resources/config/routing/admin.yml'
prefix: /admin

很抱歉,如果我发布过多代码和未格式化的错误消息......

所以,如果有人可以帮我弄清楚如何显示页面" admin / sellers"从我可以CRUD卖家,我会很棒!

1 个答案:

答案 0 :(得分:0)

根据您发布的内容,您未在cp1252 UCP -------- -------- 80 20AC (€) 85 2026 (…) 99 2122 (™) 配置中导入Artaban/SyliusSimpleMarketplacePlugin/src/Resources/config/routing/admin.yml