saxulum / saxulum-crud
This package is abandoned and no longer maintained.
No replacement package was suggested.
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
Features
Requirements
- 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
Installation
Through Composer as saxulum/saxulum-crud.
Usage
Trait
Use the following trait within your controller: Saxulum\Crud\Controller\CrudTrait.
Base configuration
crudName
: contains the lowercase name of the object, example:sample
crudObjectClass
: contains the class name of the object, example:Saxulum\Crud\Entity\Sample
Advanced configuration
crudRoutePattern
: contains a template pattern like:%s_%s
crudRolePattern
: contains a template pattern like:role_%s_%s
crudTemplatePattern
: contains a template pattern like:@SaxulumCrud/%s/%s.html.twig
Services
crudAuthorizationChecker
: contains an instance of the symfony authorization checkercrudDoctrine
: contains an instance of the doctrine manager registrycrudPaginator
: contains an instance of a knp paginatorcrudFormFactory
: contais an instance of a symfony form factorycrudUrlGenerator
: contains an instance of symfony routing url generator: deprecated by symfony 2.7, usecrudSecurity
crudAuthorizationChecker
crudTwig
: contains an instance of the twig environment
Twig: form label generation
Use the following extension to use label generation: Saxulum\Crud\Twig\FormLabelExtension.
Within the form template you can use something like this:
{% block form_label %}
{% spaceless %}
{% if label is empty %}
{% set label = prepareFormLabel(form) %}
{% endif %}
{{ parent() }}
{% endspaceless %}
{% endblock form_label %}
Example
The form name is day_edit
, there is a collection field comestiblesWithinDay
with a subfield called comestible
. As you can see the _
within the name will
be replaced by a .
.
day:
edit:
label:
comestibles_within_day: Consumption
comestibles_within_day_collection.comestible: Comestible
Advanced names: If you want the underscore within the form name,
work with camel case. Which means someFormName_edit
will be converted to
some_form_name.edit
.