I had done some research on this topic and found that some script was available in Python. With no knowledge of Python execution, I sought help from stackoverflow & got the answer there pointed to the same Python script 🙁 I decided I had to do something on my own! Ensuring the right no of spaces in the YAML could be a real pain – I haven’t found the error messages to be very friendly.
My challenge was to be able to generate a YAML for a table/schema using the nested-set behaviour in Doctrine. Instead of losing my mind on devising a human-readable format, I reverse engineered. I checked the resulting schema in the database and used that as the base for my CSV. Following this I wrote a simple macro that will output in the required format. This has evolved over a week or so, and has been thoroughly tested. I am sharing this file with 2 examples: one for the JobeetJob schema & other from the Hierarchical Data page on Doctrine.
Let me know if this helps! Vote for the answer on StackOverflow.
To start using:
- Download the ZIP file CSV/Excel to YAML Generator v2 & unzip it.
- Change the model name Continue reading Converting CSV/Excel data to Doctrine YAML fixtures