views:

122

answers:

2

Was wondering if there is an easy to convert structured files into YAML data fixtures for Doctrine / Symfony.

I don't see any utility with Doctrine to accept CSV.

I might just start writing something simple to do this. Is it worthwhile?

+1  A: 

A quick google search came up with this: http://code.activestate.com/recipes/546518-simple-conversion-of-excel-files-into-csv-and-yaml/

Requires Python though but that shouldn't be a problem. Looks quite promising and does exactly what you need (keeping in mind that CSV files can be opened with excel like a native excel file and saved as .xls)

DrColossos
thanks DrColossos, I had bumped onto this... but have never worked with Python before - don't even know what it would take to run a script like this.. I will try to achieve something simpler.. and post it here... thanks
Prasad
+1  A: 

I wrote my own Macro to solve this problem & shared it. You can specify the fields in your model, fill-out the data and the YAML is generated. The best part is that it supports Nested Data as well (based on NestedSet Doctrine Behaviour)

You can download the file from here: http://www.prasadgupte.com/go/converting-csvexcel-data-to-doctrine-yaml-fixtures/

Hope this helps!

Prasad