Download the PHP package kunicmarko/sonata-annotation-bundle without Composer
On this page you can find all versions of the php package kunicmarko/sonata-annotation-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kunicmarko/sonata-annotation-bundle
More information about kunicmarko/sonata-annotation-bundle
Files in kunicmarko/sonata-annotation-bundle
Package sonata-annotation-bundle
Short Description Symfony Bundle that adds annotations for Sonata Admin.
License MIT
Homepage https://github.com/kunicmarko20/SonataAnnotationBundle
Informations about the package sonata-annotation-bundle
Sonata Annotation Bundle
Adds Annotations for Sonata Admin.
The point is to reduce noise, having lots of admin classes with just mappings that don't do anything else should be avoided. Add annotations to your models and you are done. If you need something that is not covered by this bundle, create admin class instead.
This bundle was greatly inspired by IbrowsSonataAdminAnnotationBundle
Documentation
- Installation
- Configuration
- How to use
- Annotations
- Admin
- Access
- AddChild
- FormField
- ShowField
- ShowAssociationField
- ListField
- ListAssociationField
- DatagridField
- DatagridAssociationField
- ExportField
- ExportAssociationField
- ExportFormats
- AddRoute
- RemoveRoute
- ActionButton
- DashboardAction
- ListAction
- DatagridValues
- Extending The Admin
Installation
1. Add dependency with composer
2. Register the bundle in your Kernel
Configuration
By default we scan all files in your src
directory, if you save your entities somewhere
else you can change the directory:
How to use
Instead of creating class for Admin it is enough to just add annotation to your entity.
Clear cache:
And you will see Admin appear in your sidebar.
Annotations
Admin
Access
If you are using role handler as described here you can add permission per role with this annotation.
This annotation can be used without Admin annotation present. If you have an admin class for your entity you can still use this annotation.
AddChild
You can read more about this here.
This annotation can be used without Admin annotation present. If you have an admin class for your entity you can still use this annotation.
FormField
You can specify action option that would allow you to have different fields or have different configuration for the same field for create and edit action. If not set, field will be used for create and edit. Besides that, you are able to set the position of the field. Position 1 would be the first field to render and higher numbers after. If field doesn't have position, it will be rendered after all fields with position.
ShowField
You are able to set the position of the field. Position 1 would be the first field to render and higher numbers after. If field doesn't have position, it will be rendered after all fields with position.
ShowAssociationField
You are able to set the position of the field. Position 1 would be the first field to render and higher numbers after. If field doesn't have position, it will be rendered after all fields with position.
ListField
You are able to set the position of the field. Position 1 would be the first field to render and higher numbers after. If field doesn't have position, it will be rendered after all fields with position.
ListAssociationField
You are able to set the position of the field. Position 1 would be the first field to render and higher numbers after. If field doesn't have position, it will be rendered after all fields with position.
DatagridField
You are able to set the position of the field. Position 1 would be the first field to render and higher numbers after. If field doesn't have position, it will be rendered after all fields with position.
DatagridAssociationField
You are able to set the position of the field. Position 1 would be the first field to render and higher numbers after. If field doesn't have position, it will be rendered after all fields with position.
ExportField
You can add annotation to fields/method that you want to export, also you can add label for the field, if left blank field name will be used as label.
ExportAssociationField
ExportFormats
You can customize the export formats you want to allow, if this annotation is not present, all formats are shown.
AddRoute
Add custom routes to your admin class:
RemoveRoute
remove already existing routes:
ActionButton
This will add button next to your add button in a list view. Here you can find how the template should look like.
DashboardAction
This will add button to your dashboard block for this entity. Here you can find how the template should look like.
ListAction
DatagridValues
As explained here.
Extending The Admin
Sometimes you need to do something custom and this bundle can't help you with
that but you still want to use annotations for most of the other stuff. You can
extend our admin class KunicMarko\SonataAnnotationBundle\Admin\AnnotationAdmin
and overwrite the methods you want.
And then in your entity you just provide that class
All versions of sonata-annotation-bundle with dependencies
doctrine/annotations Version ^1.6
sonata-project/admin-bundle Version ^3.35
symfony/config Version ^3.4 || ^4.0
symfony/dependency-injection Version ^3.4 || ^4.0
symfony/finder Version ^3.4 || ^4.0
symfony/http-kernel Version ^3.4 || ^4.0