On a Symfony exploration project, I have a model using doctrine NestedSet behaviour. Since the data is prepared in a flat file, I wrote a conversion utility to generate corresponding YAML. It turns out that processing NestedSet YML of around 100 records (max_depth=4) consumes over 40MB of PHP memory, which is not available to me.
Is there a work-around to this problem?
I’m thinking of 2 possible solutions.
- Write an equivalent PHP script to populate objects & save them
- Insert data via SQL statements, the challenge being to compute the left & right nodes
What do Symfonians suggest?
Option 2 was better.
I wrote a simple macro in Excel to compute the lgt and rgt values required for the pre-order tree. Logic as mentioned here: http://www.sitepoint.com/hierarchical-data-database-2/
The same Excel utility would convert values to a SQL query that could be dumped via file.
Going through the fixtures/object route exceeded the allowed memory limit.