saxulum / saxulum-crud
此软件包已 弃用 并不再维护。没有建议的替代软件包。
Saxulum CRUD
2.0-alpha18
2015-12-13 11:43 UTC
Requires
- php: >=5.4
- doctrine/common: ~2.5
- symfony/form: ~2.8|~3.0
- symfony/http-kernel: ~2.8|~3.0
- symfony/routing: ~2.8|~3.0
- symfony/security: ~2.8|~3.0
Requires (Dev)
- doctrine/orm: ~2.5
- knplabs/knp-components: ~1.3,>=1.3.1
- phpunit/phpunit: ~4.0
- pimple/pimple: ~3.0
- symfony/form: ~2.8|~3.0
- twig/twig: ~1.2
- dev-master / 2.0.x-dev
- 2.0-alpha18
- 2.0-alpha17
- 2.0-alpha16
- 2.0-alpha15
- 2.0-alpha14
- 2.0-alpha13
- 2.0-alpha12
- 2.0-alpha11
- 2.0-alpha10
- 2.0-alpha9
- 2.0-alpha8
- 2.0-alpha7
- 2.0-alpha6
- 2.0-alpha5
- 2.0-alpha4
- 2.0-alpha3
- 2.0-alpha2
- 2.0-alpha1
- v1.x-dev
- 1.6.3
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.1
- 1.4.0
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.0
- 1.0-rc6
- 1.0-rc5
- 1.0-rc4
- 1.0-rc3
- 1.0-rc2
- 1.0-rc1
- 1.0-beta7
- 1.0-beta6
- 1.0-beta5
- 1.0-beta4
- 1.0-beta3
- 1.0-beta2
- 1.0-beta1
This package is not auto-updated.
Last update: 2020-09-22 19:11:05 UTC
README
功能
要求
- php: >=5.4,
- doctrine/common: ~2.4,
- knplabs/knp-components: ~1.3,>=1.3.1,
- symfony/form: ~2.8|~3.0,
- symfony/http-kernel: ~2.8|~3.0,
- symfony/routing: ~2.8|~3.0,
- symfony/security: ~2.8|~3.0
- twig/twig: ~1.2
安装
通过 Composer 作为 saxulum/saxulum-crud。
用法
特性
在您的控制器中使用以下特性: Saxulum\Crud\Controller\CrudTrait。
基本配置
crudName
:包含对象的名称(小写),例如:sample
crudObjectClass
:包含对象的类名,例如:Saxulum\Crud\Entity\Sample
高级配置
crudRoutePattern
:包含模板模式,例如:%s_%s
crudRolePattern
:包含模板模式,例如:role_%s_%s
crudTemplatePattern
:包含模板模式,例如:@SaxulumCrud/%s/%s.html.twig
服务
crudAuthorizationChecker
:包含 symfony 授权检查器的实例crudDoctrine
:包含 doctrine 管理注册表的实例crudPaginator
:包含 knp 分页器的实例crudFormFactory
:包含 symfony 表单工厂的实例crudUrlGenerator
:包含 symfony 路由 URL 生成器的实例:已被 symfony 2.7 弃用,使用crudSecurity
crudAuthorizationChecker
crudTwig
:包含 twig 环境的实例
Twig:表单标签生成
使用以下扩展进行标签生成: Saxulum\Crud\Twig\FormLabelExtension。
在表单模板中,您可以使用类似以下的内容
{% block form_label %}
{% spaceless %}
{% if label is empty %}
{% set label = prepareFormLabel(form) %}
{% endif %}
{{ parent() }}
{% endspaceless %}
{% endblock form_label %}
示例
表单名称为day_edit
,有一个集合字段comestiblesWithinDay
,其中包含一个子字段名为comestible
。如您所见,名称中的_
将被替换为.
。
day:
edit:
label:
comestibles_within_day: Consumption
comestibles_within_day_collection.comestible: Comestible
高级名称:如果您想在表单名称中使用下划线,请使用驼峰命名法。这意味着someFormName_edit
将被转换为some_form_name.edit
。