News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Stefan Koopmanschap:
Data migration with Doctrine2
July 25, 2012 @ 08:18:32

In this latest post to his site Stefan Koopmanschap shares a solution he's found to migrating data with Doctrine2 from an existing structure.

A project that I'm working on right now required me to migrate data from the existing database to the new database and database structure. Since the application is built on top of Symfony2, I decided to write a Command that would take care of the migration. I ran into an issue though: Doctrine2 insisted on creating new IDs where I wanted to keep the old one. The solution turned out to be really simple.

The actual code for the Command is only a few lines long - it just turns off the "AUTO" strategy for each of your entities, making it ignore any IDs you have set on the entity already.

0 comments voice your opinion now!
data migration doctrine2 strategy auto tutorial


blog comments powered by Disqus

Similar Posts

Abhinav Singh's Blog: Setting Nginx, PHP Fastcgi and XCache on a new Ubuntu

ZendCasts.com: Building a JSON End-Point With SLIM and jQuery: Part 2

Segment.io: How to Make Async Requests in PHP

PHP.net: PHP 4 end of life announcement

Joshua Thijssen: Decoding TLS with PHP


Community Events





Don't see your event here?
Let us know!


artisanfiles composer opinion list voicesoftheelephpant series library conference symfony interview community laravel framework release security introduction podcast tool language version

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework