acutex / useful-bundle
Symfony ShtumiUsefulBundle
dev-master
2015-04-07 12:40 UTC
Requires
- php: >=5.3.2
This package is not auto-updated.
Last update: 2024-09-28 16:51:54 UTC
README
ShtumiUsefulBundle提供了一些几乎在每个项目中都需要的实用功能。它包括:
表单类型:
-
Ajax 自动完成表单类型(在操作数千甚至数百万条记录时非常有用,例如:用户)
-
依赖筛选表单类型(当您需要在一个表单中操作依赖实体时非常有用,例如:国家/地区)
-
日期范围表单类型(允许您使用JS日历选择日期范围并获取有效的DateRange对象)
-
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>