News Feed
Sections




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

SitePoint PHP Blog:
Data Fixtures in Symfony2
February 27, 2014 @ 12:50:44

The SitePoint PHP blog has posted a tutorial from Taylor Ren looking at the use of fixtures in Symfony2. Fixtures allow you to create a set of test (or just initial) data to populate the database in an automated way.

Back when I first started to learn Symfony (1.x) with its Jobeet project, I thought the ability to load a bunch of test data into the database very useful. In this article, we will revisit this feature, which has been completely re-modeled and thus has a lot to teach us.

He uses two third-party libraries to give the Symfony application a bit more "power" - the DoctrineFixturesBundle and PHPUnit. The second is used for testing the results of the fixtures, not the actual loading process. He walks you through the creation of your first fixture file for a book-based example. The fixture uses the Doctrine functionality to create "place" data. He includes the command to run the fixture (via the Symfony app/console command) and what the result should look like. He comes back around and shows the same process with other general book data, also talking about primary keys and references.

0 comments voice your opinion now!
data fixture database symfony2 application tutorial example

Link: http://www.sitepoint.com/data-fixtures-symfony2/

blog comments powered by Disqus

Similar Posts

NETTUTS.com: CodeIgniter from Scratch: File Uploading and Image Manipulation

Till Klampaeckel: Continuous Integration: Automated database setup with Doctrine on Travis-CI

John Maver's Blog: How to create a Bebo application using PHP 5

Working Software Blog: Escaping single and double quotes for use with XPath queries in PHP

WebCheatSheet.com: PHP: Dynamic Image Generation


Community Events





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


community library opinion symfony deployment api introduction laravel package tips language update framework bugfix interview install release zendserver series podcast

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