jupeter/doctrine-dump-fixtures-bundle

Symfony DoctrineDumpFixturesBundle

Installs: 3 175

Dependents: 0

Suggesters: 0

Security: 0

Stars: 8

Watchers: 3

Forks: 2

Open Issues: 2

Type:symfony-bundle

1.1 2017-01-26 13:57 UTC

This package is not auto-updated.

Last update: 2024-05-06 11:37:48 UTC


README

Bundle for Symfony 3, with you can dump database data into fixtures.

Dump Fixtures are used to dump database data into fixtures file.

Setup and Configuration

Doctrine Dump fixtures for Symfony are maintained in the DoctrineDumpFixturesBundle. The bundle uses external Doctrine Data Fixtures library.

Follow these steps to install the bundle and the library in the Symfony Standard edition. Run command in your project diretory:

$ composer require jupeter/doctrine-dump-fixtures-bundle

Finally, register the Bundle DoctrineDumpFixturesBundle in app/AppKernel.php.

// ...
public function registerBundles()
{
    $bundles = array(
        // ...
        new TeamLab\Bundle\FixturesBundle\DoctrineDumpFixturesBundle(),
        // ...
    );
    // ...
}

Configuration

To dump entity data, you need setup annotation for entity:

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use TeamLab\Bundle\FixturesBundle\Mapping as Dump;  # use Annotation

/**
 * @ORM\Entity
 * @Dump\Entity # configure with entities should be dumped
  */
class Offers 
{
     // ...
     
     /**
      * @ORM\Column(type="string")
      * @Dump\Column # configure with columns should be dumped
      */
     private function $name;
     
     // ...
}

Dump existing data into fixtures

To dump all data from database to Fixtures, run command:

$ ./bin/console doctrine:fixtures:dump