adamwjtk/some-example-bundles

作业项目

dev-master 2018-08-10 09:03 UTC

This package is not auto-updated.

Last update: 2024-09-25 11:06:39 UTC


README

1 - 安装bundle

composer require adamwjtk/some-example-bundles dev-master

2 - 在内核中启用bundle

    public function registerBundles()
    {
        $bundles = [

            new \AdamwjtkProductBundle\AdamwjtkProductBundle(),
            new \AdamwjtkClientBundle\AdamwjtkClientBundle(),
            
        ];

3 - 注册路由

# app/config/routing.yml

adamwjtk_client:
    resource: "@AdamwjtkClientBundle/Resources/config/routing.yml"
    prefix: /client

adamwjtk_product:
    resource: "@AdamwjtkProductBundle/Resources/config/routing.yml"
    prefix:   /api/v1/product

4 - 注册服务

# app/config/services.yml


    AdamwjtkProductBundle\:
        resource: '../../vendor/adamwjtk/some-example-bundles/src/Adamwjtk/ProductBundle/*'
        exclude: '../../vendor/adamwjtk/some-example-bundles/src/Adamwjtk/ProductBundle/{Entity,Repository,Tests}'
# app/config/config.yml
imports:

    - { resource: "@AdamwjtkProductBundle/Resources/config/services.yml"} 

5 - 将资源从 \vendor\adamwjtk\some-example-bundles\src\Adamwjtk\ClientBundle\Resources\public 移动到 \web 并设置 config.yml 如下

twig:
    //.....
    form_themes:
      - bootstrap_3_layout.html.twig

6 - 更新数据库

  php bin/console doctrine:schema:update --force

7 - 运行

{your.domain}/app_dev.php/client/list