Download the PHP package jgrygierek/batch-entity-import-bundle without Composer

On this page you can find all versions of the php package jgrygierek/batch-entity-import-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package batch-entity-import-bundle

BatchEntityImportBundle

Code Style Tests Code Coverage PHP Versions Symfony Versions SymfonyInsight

Importing entities with preview and edit features for Symfony.

Documentation

Installation

Install package via composer:

Add entry to bundles.php file:

Configuration class

To define how the import function should work, you need to create a configuration class.

Basic configuration class

In the simplest case it will contain only class of used entity.

Then register it as a service:

Fields definitions

If you want to change types of rendered fields, instead of using default ones, you have to override method in your import configuration. If name of field contains spaces, you should use underscores instead.

To avoid errors during data import, you can add here validation rules.

Matrix validation

This bundle provides two new validators.

1) DatabaseEntityUnique validator can be used to check if record data does not exist yet in database. 2) MatrixRecordUnique validator can be used to check duplication without checking database, just only matrix records values.

Names of fields should be the same as names of columns in your uploaded file. With one exception! If name contains spaces, you should use underscores instead.

Passing services to configuration class

If you want to pass some additional services to your configuration, just override constructor.

Show & hide entity override column

If you want to hide/show an entity column that allows you to override entity default: true, you have to override this method in your import configuration

Optimizing queries

If you use KnpLabs Translatable extension for your entity, probably you will notice increased number of queries, because of Lazy Loading.

To optimize this, you can use getEntityTranslationRelationName() method to pass the relation name to the translation.

Creating controller

Create controller with some required code.

This is just an example, depending on your needs you can inject services in different ways.

To enable automatic passing configuration service to your controller, please use ImportConfigurationAutoInjectInterface and ImportConfigurationAutoInjectTrait.

Translations

This bundle supports KnpLabs Translatable behavior.

To use this feature, every column with translatable values should be suffixed with locale, for example:

If suffix will be added to non-translatable entity, field will be skipped.

If suffix will be added to translatable entity, but field will not be found in translation class, field will be skipped.

Overriding templates

Global templates

You have two ways to override templates globally:

Controller-specific templates

If you have controller-specific templates, you can override them in controller:

Main layout

Block name used in templates is batch_entity_import_content, so probably there will be need to override it a bit. You can create a new file with content similar to the given example. Then just use it instead of original layout file.

Then you just have to override it in bundle directory, or change a path to layout in your configuration.

Additional data

If you want to add some specific data to the rendered view, just override these methods in your controller:

Importing data to array field

If your entity has an array field, and you want to import data from CSV file to it, this is how you can do it.

Entity

Import configuration

CSV file

Full example of CSV file


All versions of batch-entity-import-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
doctrine/annotations Version ^1.14|^2.0
doctrine/orm Version ^2.9|^3.2
phpoffice/phpspreadsheet Version ^3.6.0
symfony/config Version ^5.4|^6.0|^7.0
symfony/dependency-injection Version ^5.4|^6.0|^7.0
symfony/doctrine-bridge Version ^5.4|^6.0|^7.0
symfony/form Version ^5.4|^6.0|^7.0
symfony/framework-bundle Version ^5.4|^6.0|^7.0
symfony/property-access Version ^5.4|^6.0|^7.0
symfony/translation Version ^5.4|^6.0|^7.0
symfony/twig-bundle Version ^5.4|^6.0|^7.0
symfony/validator Version ^5.4|^6.0|^7.0
twig/twig Version ^2.14|^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jgrygierek/batch-entity-import-bundle contains the following files

Loading the files please wait ....