This repository has been archived by the owner. It is now read-only.
Data import bundle for move datas between different databases
PHP Shell HTML
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Command
Controller
DependencyInjection
Manager
Resources
Tests/Controller
.gitignore
DelirehberiImportBundle.php
README.md
composer.json

README.md

Import Bundle

Join the chat at https://gitter.im/delirehberi/importbundle

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require delirehberi/import ">=1"

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Delirehberi\ImportBundle\DelirehberiImportBundle(),
        );

        // ...
    }

    // ...
}

Step 3: Configure your mapping

Open your config file (app/config/config.yml) and edit like this:

parameters:
  delirehberi_import:
    connection_key:
      database:
        driver: pdo_mysql
        user: root
        password: null
        dbname: old_database_name
        host: localhost
        port: ~
        charset: 'utf8'
      maps:
        news:
          entity: Acme\ContentBundle\Entity\Content
          old_data:
            service_id: my_project.data_service
            method: getOldData
          fields:
            old_id:
              type: integer
              name: ID
          ...

Ps: if you don't want update existing items you can add this config to your config.yml file:

delirehberi_import:
    update: false

Documentation

See the summary.