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
- Host: GitHub
- URL: https://github.com/networking/sonata-admin-annotation-bundle
- Owner: networking
- Created: 2019-11-22T09:04:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-22T09:21:58.000Z (over 6 years ago)
- Last Synced: 2025-03-03T18:47:53.511Z (over 1 year ago)
- Language: PHP
- Size: 15.6 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
IbrowsSonataAdminAnnotationBundle
============================
Manage Sonata Form, Data, List and ShowMapper over annotations
[](https://packagist.org/packages/ibrows/sonata-admin-annotation-bundle) [](https://packagist.org/packages/ibrows/sonata-admin-annotation-bundle)
[](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)