An open API service indexing awesome lists of open source software.

https://github.com/networking/sonata-admin-annotation-bundle

Replacement for Ibrows bundle
https://github.com/networking/sonata-admin-annotation-bundle

Last synced: about 2 months ago
JSON representation

Replacement for Ibrows bundle

Awesome Lists containing this project

README

          

IbrowsSonataAdminAnnotationBundle
============================

Manage Sonata Form, Data, List and ShowMapper over annotations

[![Latest Stable Version](https://poser.pugx.org/ibrows/sonata-admin-annotation-bundle/v/stable)](https://packagist.org/packages/ibrows/sonata-admin-annotation-bundle) [![Total Downloads](https://poser.pugx.org/ibrows/sonata-admin-annotation-bundle/downloads)](https://packagist.org/packages/ibrows/sonata-admin-annotation-bundle)

[![knpbundles.com](http://knpbundles.com/ibrows/IbrowsSonataAdminAnnotationBundle/badge-short)](http://knpbundles.com/ibrows/IbrowsSonataAdminAnnotationBundle)

How to install
==============

### Add Bundle to your composer.json

```js
// composer.json

{
"require": {
"ibrows/sonata-admin-annotation-bundle": "*"
}
}
```

### Install the bundle from console with composer.phar

``` bash
$ php composer.phar update ibrows/sonata-admin-annotation-bundle
```

### Enable the bundle in AppKernel.php - Dont forget to give AppKernel to the Bundle and register the Bundle *BEFORE* SonataAdminBundle

``` php
If any FormMapperExclude Annotation is found on a property the reader assumes that there es an Order/FormMapperAll on the class (same goes for the other annotations - List/Form/Datagrid)

Have a look on the Annotations to see what options they accept

### Example

``` php
add('countries');
}
}
```

### Using in the Admin (maybe in an AbstractAdmin.php)

#### With the AbstractSonataAdminAnnotationAdmin

```php
=5.4)
```php
getSonataAnnotationReader()->configureListFields($this->getClass(), $listMapper);
}

/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$this->getSonataAnnotationReader()->configureFormFields($this->getClass(), $formMapper);
}

/**
* @param ShowMapper $showMapper
*/
protected function configureShowFields(ShowMapper $showMapper)
{
$this->getSonataAnnotationReader()->configureShowFields($this->getClass(), $showMapper);
}

/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$this->getSonataAnnotationReader()->configureDatagridFilters($this->getClass(), $datagridMapper);
}

/**
* @return ContainerInterface
*/
protected function getContainer()
{
return $this->getConfigurationPool()->getContainer();
}

/**
* @return SonataAdminAnnotationReaderInterface
*/
protected function getSonataAnnotationReader()
{
return $this->getContainer()->get('ibrows_sonataannotation.reader');
}
}
```

Known issues
============
### Version 2.2.*

- When using the @AutoService Annotation you have to clear the cache everytime you make changes on this Annotation (remove/add/edit). Reason is that the appDevDebugContainer is fully cached and the CompilerPass cannot register the new changes.

### Version 1.1.*

- Using oneToMany/manyToOne relations produces an "entity not managed" doctrine error. Reason is that FormMapper-Annotation per default sets by_reference to false, using @FormMapper(options={"by_reference"=true}) will fix that.

New features
============

### Version 2.4

- New "tab" and "tabOptions" in FormMapper and ShowMapper Annotation for grouping -> @FormMapper(tab="Main")

### Version 2.2

- Allow to register SonataAdminServices over Annotations with @AutoService @see Known issues for caching problems

### Version 1.2

- Allow reorder of FormMapper/ShowMapper and ListMapper with @Order/FormReorder, @Order/ShowReorder, @Order/ListReorder or @Order/ShowAndFormReorder annotations

### Version 1.1

- New "with" and "withOptions" in FormMapper and ShowMapper Annotation for grouping -> @FormMapper(with="Main")
- Allow configuration of static callback methods in entity with @FormCallback on Method (see @FormCallback example)