Jun
2
Writing dynamic fixtures in Symfony
Filed Under Symfony
Whenever writing dynamic fixtures in Symfony, be careful about putting new line characters, after each property, but not after the main object declaration. Second, make sure you don’t start with any whitespace, and that the entire yml file does not contain unnecessary new lines or spaces. To debug, simply enable query logging in your database, and you’ll see that, when something is wrong, parts of the query will be mushed-up. Simple example (just look where “\n” is and where it isn’t):
<?php for ($i=0; $i<10;$i++):?>
Article_<?php echo $i; ?>:
Title: This is my title <?php echo $i.”\n”; ?>
Content: What a cool article
<?php endfor; ?>
Comments
Leave a Reply







