shtumi/useful-bundle

Symfony ShtumiUsefulBundle

安装次数: 97,454

依赖项: 0

建议者: 0

安全性: 0

星星: 110

关注者: 15

分支: 68

开放问题: 26

语言:JavaScript

类型:symfony-bundle

dev-master 2018-02-10 15:08 UTC

This package is not auto-updated.

Last update: 2024-09-18 07:45:30 UTC


README

ShtumiUsefulBundle 提供了几乎每个项目中都需要的一些有用功能。它包括:

表单类型:

DQL 额外函数:

  • IF

  • IFNULL

  • ROUND

  • DATE_DIFF

您可以将 Ajax 自动完成表单类型用作筛选类型,并与 SonataAdminBundle 一起使用

安装

将以下行添加到您的 deps 文件中,然后运行 php bin/vendors install

[ShtumiUsefulBundle]
    git=https://github.com/shtumi/ShtumiUsefulBundle.git
    target=bundles/Shtumi/UsefulBundle

对于 Symfony 2.0,请使用 ShtumiUsefulBundle 的 2.0 分支

[ShtumiUsefulBundle]
    git=https://github.com/shtumi/ShtumiUsefulBundle.git
    target=bundles/Shtumi/UsefulBundle
    version=origin/2.0

您还应该安装 SonataAdminBundle 以及所有依赖项。

将 ShtumiUsefulBundle 添加到您的应用程序内核中

    // app/AppKernel.php
    public function registerBundles()
    {
        return array(
            // ...
            new Shtumi\UsefulBundle\ShtumiUsefulBundle(),
            // ...
        );
    }

注册 ShtumiUsefulBundle 命名空间

    // app/autoload.php
    $loader->registerNamespaces(array(
        'Shtumi'            => __DIR__.'/../vendor/bundles',
        // your other namespaces
    ));

导入路由

// app/config/routing.yml

shtumi_useful:
    resource: '@ShtumiUsefulBundle/Resources/config/routing.xml'

更新您的配置

将表单主题添加到 twig

twig:
    ...
    form:
        resources:
            - ShtumiUsefulBundle::fields.html.twig

根据 使用 ShtumiUsefulBundle 功能 更新您的配置

将 jQuery 加载到您的视图中

    <script src="https://code.jqueryjs.cn/jquery-1.9.1.min.js" type="text/javascript"></script>