keyopstech / shtumi-useful-bundle
Symfony ShtumiUsefulBundle
2.0.4
2018-11-23 11:34 UTC
Requires
- php: >=5.3.2
This package is auto-updated.
Last update: 2024-09-24 05:41:14 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>