Home | About Me
| | | | | | | | | |

Symfony 3: Data fixtures

Hands-On | 14 Mar 2019
Tags: symfony, ready, fixtures, data-fixtures, doctrine


1) Installation

composer require --dev doctrine/doctrine-fixtures-bundle

2) Fixtures class

setName('My first post');
        $plan->setDescription('This is my first post');
        $manager->persist($plan);

        $manager->flush();
    }
}

3) Loading fixtures

php bin/console doctrine:fixtures:load
# Data will be purged using truncate statement
php bin/console doctrine:fixtures:load --purge-with-truncate