PHPackages                             kunicmarko/sonata-annotation-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. kunicmarko/sonata-annotation-bundle

AbandonedArchivedSymfony-bundle

kunicmarko/sonata-annotation-bundle
===================================

Symfony Bundle that adds annotations for Sonata Admin.

1.2.1(6y ago)2115.6k↓100%7MITPHPPHP ^7.1

Since Mar 25Pushed 5y ago5 watchersCompare

[ Source](https://github.com/kunicmarko20/SonataAnnotationBundle)[ Packagist](https://packagist.org/packages/kunicmarko/sonata-annotation-bundle)[ Docs](https://github.com/kunicmarko20/SonataAnnotationBundle)[ RSS](/packages/kunicmarko-sonata-annotation-bundle/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (10)Dependencies (20)Versions (14)Used By (0)

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](https://github.com/ibrows/IbrowsSonataAdminAnnotationBundle)

[![PHP Version](https://camo.githubusercontent.com/2dcf2757d7a2ae7d144c6e7d9b63bd3383509e6b70bacccb3bd8ad04d1c2541c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545372e312d626c75652e737667)](https://img.shields.io/badge/php-%5E7.1-blue.svg)[![Latest Stable Version](https://camo.githubusercontent.com/e997cbe049a8104b80e9d90405526728fcbdba1d1eef5c42e56ddd2c8be5bb27/68747470733a2f2f706f7365722e707567782e6f72672f6b756e69636d61726b6f2f736f6e6174612d616e6e6f746174696f6e2d62756e646c652f762f737461626c65)](https://packagist.org/packages/kunicmarko/sonata-annotation-bundle)[![Latest Unstable Version](https://camo.githubusercontent.com/5a0e4d0e0209bf7f70621507feed4c7cb0adff45f61c242c3e8bcba05fa9458e/68747470733a2f2f706f7365722e707567782e6f72672f6b756e69636d61726b6f2f736f6e6174612d616e6e6f746174696f6e2d62756e646c652f762f756e737461626c65)](https://packagist.org/packages/kunicmarko/sonata-annotation-bundle)

[![Build Status](https://camo.githubusercontent.com/68ccaaed4e617a98cc60b72f5cc52c0616277afa6b19f9551c877833d76f8db8/68747470733a2f2f7472617669732d63692e6f72672f6b756e69636d61726b6f32302f536f6e617461416e6e6f746174696f6e42756e646c652e7376673f6272616e63683d312e78)](https://travis-ci.org/kunicmarko20/SonataAnnotationBundle)[![Coverage Status](https://camo.githubusercontent.com/98c0d6be69a1cfc4ca934d78fc61338029cd47659e13ee07ff53529e8d4b92bf/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6b756e69636d61726b6f32302f536f6e617461416e6e6f746174696f6e42756e646c652f62616467652e7376673f6272616e63683d312e78)](https://coveralls.io/github/kunicmarko20/SonataAnnotationBundle?branch=1.x)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/26f604e52031740539f48c51eda4e68e0c5046f48c9b0eb00957deb4628cac04/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b756e69636d61726b6f32302f536f6e617461416e6e6f746174696f6e42756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d312e78)](https://scrutinizer-ci.com/g/kunicmarko20/SonataAnnotationBundle/?branch=1.x)

Documentation
-------------

[](#documentation)

- [Installation](#installation)
- [Configuration](#configuration)
- [How to use](#how-to-use)
- [Annotations](#annotations)
    - [Admin](#admin)
    - [Access](#access)
    - [AddChild](#addChild)
    - [FormField](#formfield)
    - [ShowField](#showfield)
    - [ShowAssociationField](#showassociationfield)
    - [ListField](#listfield)
    - [ListAssociationField](#listassociationfield)
    - [DatagridField](#datagridfield)
    - [DatagridAssociationField](#datagridassociationfield)
    - [ExportField](#exportfield)
    - [ExportAssociationField](#exportassociationfield)
    - [ExportFormats](#exportformats)
    - [AddRoute](#addroute)
    - [RemoveRoute](#removeroute)
    - [ActionButton](#actionbutton)
    - [DashboardAction](#dashboardaction)
    - [ListAction](#listaction)
    - [DatagridValues](#datagridvalues)
- [Extending The Admin](#extending-the-admin)

Installation
------------

[](#installation)

**1.** Add dependency with composer

```
composer require kunicmarko/sonata-annotation-bundle
```

**2.** Register the bundle in your Kernel

```
return [
    //...
    KunicMarko\SonataAnnotationBundle\SonataAnnotationBundle::class => ['all' => true],
];
```

Configuration
-------------

[](#configuration)

By default we scan all files in your `src` directory, if you save your entities somewhere else you can change the directory:

```
sonata_annotation:
    directory: '%kernel.project_dir%/src/'
```

How to use
----------

[](#how-to-use)

Instead of creating class for Admin it is enough to just add annotation to your entity.

```
