Data migration with Doctrine2
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.
As it turns out, the cause of the problem is the fact that when you specify strategy="AUTO" for your ID-field, Doctrine2 will ignore any existing ID you've set in the entity. It will generate one because, well, you've specified it should be doing this. And usually, this is correct behaviour, but with the migration of existing data, to retain correct relations etc, it is much easier to keep the old IDs.
The solution is easy and, as usual, I found it thanks to StackOverflow. In your migrationscript, for each of the entities you're migrating, you just temporarily turn off the strategy:
As soon as I had added the above snippet for all the entities I'm migrating, it kept the old IDs and migration all of a sudden went flawlessly.
Update: The above method assumes you have a way of setting the ID in the entity, for instance a setId() method.
July 25, 2012 - tags: php, symfony, symfony2, doctrine2, data migration
: koss ktxpro1 titanium portable headphones with volume control. i should start off by saying that i'm a total newbie to the do-it-yourself electronics scene. logitech's sports headphones are designed especially for active types, with a lightweight frame that won't weigh your head down (cos those normal ones leave your head lolling about uncontrollably, right
: at any given time the car itself would consume as much as half of that to power all of its systems. bansko quickly developed into a more modern winter holiday resort with an explosion of hotels and apartment blocks. the main advantages of using wi-fi technology is the lack of wires. only our minds and logic will get us off this island." person 4: born while jupiter moved through capricorn says, "i believe in tradition. firstly he points out that if the trade with arabia was all-important, a site actually on the coast, or at least closer to the eastern edge of the plateau, with consequently shorter routing, would have been far more appropriate than aksum itself.
: I will say thanks to you for sharing informative news.
help with marketing paper writing
: Your fabulous article Data migration with Doctrine2 has provided me the information that i was looking for recognition for the blog... its tremendous
: you could start a new tradition and get him a phone cover. replacement - tube guitar output (1750 series). try not to pop your gum, slurp your coffee or make loud exclamations or noises that show displeasure over a task or interaction. watching videos or movie clips is fairly decent except for a couple of seconds for some videos to buffer. the quality of the reception is mediocre, but it allows me to answer phone calls in the car, which is nice.
microscope parts body tube
: compound light microscope diagram worksheet - web - pemonitorhosted. a later comprehensive polymorphism screen is to find as many forms as possible in order to exhaustively cover the intellectual property space. lois and jim show up start arguing with clark. this is closely related to number 3.
glutathione and sod liposomal cream
: children with autism are taking in a lot of information all the time; this means that at some stage, they have to sort through this information to see what they really need. the richest sources of phytonutrients are fruits and vegetables. essential fatty acids. glutamax reduced glutathione works inside our body while glutamax lightening soap works on the outside. despite the cancer prevention roles, researches have in fact found that beta-carotene tends to increase the risks of lung cancer in smokers and alcoholics.
Toyota Hilux For Sale
: Thanks to this blog I finally managed to find the information matching my criteria and for this I would like to thank the author for sharing this blog with us. Looking forward for more.Toyota Hilux For Sale
appointment setting companies
: I have been reading your post for years. And I must say that your ideas seems fresh every time.
: This is really wonderful information and I will regret you.
: alkaline water ionizer companies fol people to buy their costly products which harm the human body more than they benefit them actually.
glutathione recycler apex
: digesting your food properly, helps your system to distribute the nutrients throughout your body's other organs accordingly. dr drew and the mirror effect: fame without foundation we still have this year and her senior year to go, but hopefully she will make it a full year this year and be able to graduate next year. you can find prices cheaper than walmart, bestbuy or target deals with free shipping on over $25 and discount prices guarantee everyday sale. max international, maxone, maxgxl, max n-fuze, max4u, maxatp, visible solutions, max
Sample Interview Thank You Letter After Rejection
: as its a relatively new type of service, you may not be familiar with what it is, exactly. this catheter is the profession of cardiac cath lab nurse is in vogue these days among the nurse community. there are many parents that want to be a part of their baby's care, and therefore you as a nurse are going to be there to help them. your prospective employer just wants to know that you have a focus on safety and using standard precautions.
mp3 players ipod nano
: the aquapac mp3 case is designed to protect the apple ipod as well as mp3 players from creative zen, iriver, microsoft zune and the sony walkman. it's being used because it's very difficult to see the cd mechanism components in a slot-loading cd player that's used in a car audio cd mechanism. creative muvo mix 256 mb mp3 player its boombox-style design is sure to make your jamming sessions even more fun.
Cl And Phentermine
: which then results in contraction. as a result, vegetation growing in a more large garden salad topped with grilled salmon. stay educated with information on phentermine medication while you go ahead with usage of this medication for attaining optimistic weight loss results.
microscope vector graphic
: uncle kerry's yeast movie drive-in, featuring microscopes for kids. in stealth mode, you are undetectable because none of the infrared leds light up. free shipping carson z-pix 34-168x digital zoom microscope @ amazon.com.
Government Jobs Corpus Christi Tx
: modeling and acting career advice connect with key people, share information and effective practices, and optimize resources. ace network conferences, forums and learning events ensure that participants/members are kept up to date with the latest thinking and trends in the career education and development field. these are ten job ideas that provide variety and do not involve a significant amount of time in an office. for more career advice, please read "jobs that pay $50,000 to over $100,000 a year" and "jobs that pay well over a million dollars a year." you might also check out "dangerous jobs that pay well over $50,000 a year without a college degree" and "jobs that pay a lot more than you think." sales & service specialist and bank teller
cd player to mp3
: see our collection of in car stereos and other in car stereo related products, available from some of the best uk motoring shops online. titan sound usb turntable with stereo speakers for recording vinyl albums onto pcs in mp3 format ($19.99; $180 value). hard drives and the various technologies which power them. also, the players offer a battery life of 50 hrs for playing audio files and 10hrs video playback.
SEM Expert: I appreciate spending some time to talk about that, I believe firmly regarding this and so really enjoy understanding more about this kind of subject.Keep up the good work!
Josh Groban Closer Album Covers
: 15. it has various movies and shows daily that can be seen with the entire family. when rock music invades most of the radios, the rural radios are united together to fight back rock music.
: quote: originally posted by dirtypete. the adult kidney weighs about 150g. scale multi-functional, compact control unit • compact and robust stand alone camera for use with or without a pc. even though cervical cancer is one of the most common types of cancers seen in women, and it was once the most common cause of deaths related to cancer in women, there has been a drastic decrease in deaths over the last forty years; deaths from the disease have declined by as much as seventy five percent.
: home > anime novelties > designer headphones > art life style designer headphones > art life headphones (white w/ black star) "sold out". the year began with him and his band the mothers of invention flying over to england to make the movie “200 motels.” it was an illfated project which saw bassist jeff simmons quit the band days before shooting began, unhappy with how he was being asked to portray himself in the movie. you can communicate with a hearing-impaired individual, face-to-face by various possible means. once this task is complete, i will create the project and add the database.
Chest Freezer Sale
: one that is smooth and easy to swallow. chicken tetrazzini recipe the game is preferred by all age groups and is amenable to both indoor and outdoor conditions. you don't have to get an espresso toy chest just for toys. wine bottles are not intended to ensure protection against ultraviolet light even the dark colored green bottles will not supply adequate uv protection.
Fax Number Porting Efax
: sending a fax from the internet is different from traditional faxing because it cuts out the time, hassle and paper. i've had many problems with companies who outsource it to india because of language barriers. french fax sheet trend: star fax cover sheet creator, ms word fax. selection of software according to "french fax sheet" topic. star fax cover sheet creator. this application makes printing fax cover sheets just so easy. fax cover sheet template word 2003 fax cover sheet template word. fax cover sheet template word 2003 for faxing cost-effective for your company is ideal once you are working in the office that wants a lot of your attention specially.
: to get 20 subnets, you would need to borrow 5 bits so the subnet mask would be 255.255.255.248. the apex of the lobes is serrated. the website's alexa rank is 7344, and it's google page rank is 6. pocket sized and lightweight.
Eureka Vacuum 4870 Rz
: a powerful air purifier fan will circulate the air well. with an evaporative capacity of 0.50 gallons per hour, the aprilaire 500 humidifier is perfect to provide humidification for homes of up to 3000 square feet, if they are tightly constructed. to maintain an optimum temperature, one can set a temperature at which the thermostat stops further heating.
: a good guide book recommended is "turn left at orion: a hundred night sky objects to see in a small telescope--and how to find them by guy consolmagno, dan m. when more energy is taken in than is applied, the result is fat storehouse. all you need to do is buy crops in the game store and wait for them to grow.
Government Jobs Nj Accounting
: urban planning jobs for urban planners from urbanplannerjobs.com. find your next great urban planning job welcome to urbanplannerjobs.com, a career community. auburn hills, mi us: entry level engineer: columbus, in us: instrumentation and c.
Government Jobs Mandarin
: the associated press recent editorials from tennessee newspapers jan. as 2012 enters its second month, a lot of excitement is afoot at mexican insurance store. depending what your job is you have different views. i hope i can help them reflect internally on this project and the job weve given them. having so many polyps gives people with fap a 100 chance of. pete hoekstra, a former michigan congressman running for senate, falsely claims in a tv ad that president obamas stimulus lost 2. instant realtime quotes and apply now for individual health insurance. job bennett motor express, llc a family owned and operated company thank you for taking.