2017 © Pedro Peláez
 

symfony-bundle sonata-import-bundle

Import bundle to the Sonata Admin Bundle

image

doctrs/sonata-import-bundle

Import bundle to the Sonata Admin Bundle

  • Sunday, July 29, 2018
  • by DOC_tr
  • Repository
  • 3 Watchers
  • 5 Stars
  • 689 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 9 Versions
  • 32 % Grown

The README.md

Sonata Import Bundle

Add import to sonata admin bundle, (*1)

Build Status Scrutinizer Code Quality SensioLabsInsight, (*2)

Installation

Run, (*3)

composer require doctrs/sonata-import-bundle

Register the bundle in your AppKernel.php, (*4)

new Doctrs\SonataImportBundle\DoctrsSonataImportBundle()

If you have not bundle white-october/pagerfanta-bundle register this in AppKernel.php too., (*5)

new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),

Add orm mapping in your config.yml, (*6)

doctrine:
    # ...
    orm:
        # ...
        entity_managers:
            default:
                mappings:
                    DoctrsSonataImportBundle: ~

Add settings of bundle, (*7)

doctrs_sonata_import:
    mappings:
    #   - { name: center_point, class: doctrs.form_format.point}
    #   - { name: city_autocomplete, class: doctrs.form_format.city_pa}
        - { name: date, class: doctrs.type.datetime}
        - { name: datetime, class: doctrs.type.datetime}
        - { name: boolean, class: doctrs.type.boolean}
        - { name: integer, class: doctrs.type.integer}
        - { name: entity, class: doctrs.type.entity}
        - { name: choice, class: doctrs.type.entity}
    upload_dir: %kernel.root_dir%/../web/uploads    
    class_loaders:
        - { name: CSV, class: Doctrs\SonataImportBundle\Loaders\CsvFileLoader}
    #   - { name: XLS, class: AppBundle\Loader\Doctrs\XlsFileLoader}
    encode:
        default: utf8
        list:
            - cp1251
            - utf8
            - koir8

Update your database, (*8)

php app/console doctrine:migrations:diff
php app/console doctrine:migrations:migrate

If you have not migrations run this, (*9)

php app/console doctrine:schema:update --force

Installation of bundle success, (*10)

Change sonataAdminBundle entities

Add or change methods configureRoutes and getDashboardActions in sonata admin classes, (*11)

use Sonata\AdminBundle\Admin\AbstractAdmin;
...
class AnyClassAdmin extends AbstractAdmin {
...
    protected function configureRoutes(RouteCollection $collection)
    {
        $collection->add('import', 'import', [
            '_controller' => 'DoctrsSonataImportBundle:Default:index'
        ]);
        $collection->add('upload', '{id}/upload', [
            '_controller' => 'DoctrsSonataImportBundle:Default:upload'
        ]);
        $collection->add('importStatus', '{id}/upload/status', [
            '_controller' => 'DoctrsSonataImportBundle:Default:importStatus'
        ]);
    }
    ...
    public function getDashboardActions()
    {
        $actions = parent::getDashboardActions();

        $actions['import'] = array(
            'label'              => 'Import',
            'url'                => $this->generateUrl('import'),
            'icon'               => 'upload',
            'template'           => 'SonataAdminBundle:CRUD:dashboard__action.html.twig', // optional
        );

        return $actions;
    }

If you don't redefined these methods you can use trait, (*12)

use Doctrs\SonataImportBundle\Admin\AdminImportTrait;
use Sonata\AdminBundle\Admin\AbstractAdmin;
...
class AnyClassAdmin extends AbstractAdmin {
...
use AdminImportTrait;

Both methods add in AdminImportTrait, (*13)

The Versions

29/07 2018

dev-master

9999999-dev https://github.com/Doctrs/SonataImportBundle

Import bundle to the Sonata Admin Bundle

  Sources   Download

MIT

The Requires

 

by Avatar DOC_tr

symfony sonata import

14/12 2017

1.3

1.3.0.0 https://github.com/Doctrs/SonataImportBundle

Import bundle to the Sonata Admin Bundle

  Sources   Download

MIT

The Requires

 

by Avatar DOC_tr

symfony sonata import

17/10 2017

dev-scrutinizer-patch-1

dev-scrutinizer-patch-1 https://github.com/Doctrs/SonataImportBundle

Import bundle to the Sonata Admin Bundle

  Sources   Download

MIT

The Requires

 

by Avatar DOC_tr

symfony sonata import

12/10 2017

1.2

1.2.0.0 https://github.com/Doctrs/SonataImportBundle

Import bundle to the Sonata Admin Bundle

  Sources   Download

MIT

The Requires

 

by Avatar DOC_tr

symfony sonata import

10/10 2017

1.1

1.1.0.0 https://github.com/Doctrs/SonataImportBundle

Import bundle to the Sonata Admin Bundle

  Sources   Download

MIT

The Requires

 

by Avatar DOC_tr

symfony sonata import

03/10 2017

1.0.3

1.0.3.0 https://github.com/Doctrs/SonataImportBundle

Import bundle to the Sonata Admin Bundle

  Sources   Download

MIT

The Requires

 

by Avatar DOC_tr

symfony sonata import

27/09 2017

1.0.2

1.0.2.0 https://github.com/Doctrs/SonataImportBundle

Import bundle to the Sonata Admin Bundle

  Sources   Download

MIT

The Requires

 

by Avatar DOC_tr

symfony sonata import

27/09 2017

1.0.1

1.0.1.0 https://github.com/Doctrs/SonataImportBundle

Import bundle to the Sonata Admin Bundle

  Sources   Download

MIT

The Requires

 

by Avatar DOC_tr

symfony sonata import

26/09 2017

1.0

1.0.0.0 https://github.com/Doctrs/SonataImportBundle

Import bundle to the Sonata Admin Bundle

  Sources   Download

MIT

The Requires

 

by Avatar DOC_tr

symfony sonata import