i've been using fixtures for migrations purpose and also needed to use php to generate the proper yaml file. My work around this problem was doing something like:
<?php $handle=fopen(sfConfig::get('sf_data_dir')."/fixtures/csv/file.csv","r")?>
<?php fgetcsv($handle,0, ";"); ?>
<?php $i=100; ?>
<?php while (($data = fgetcsv($handle,0, ";")) !== false):?>
<?php
$code=trim($data[0]);
$user=trim($data[1]);
$criteria = new Criteria();
$criteria->add(ObjectPeer::CODE, $code);
$unit= objectPeer::doSelectOne($criteria, $error);
if (is_null($unit) || empty($unit))
continue;
?>
auto_generated_label_<?php echo 'value'.$i; $i++?>:
attribute_1: <?php echo $user ?>
attribute_2: <?php echo $unit->getId() ?>
<?php endwhile ?>
So in symfony 1.2 this is working nicely, and remember, always leave a blank like between each yaml entity like in the example, and respect indentation when dealing with php embebbed on a yaml file, because those blank lines will not be there when the yaml parse reads it, so if you not put them, you could end up with somethink like:
auto_generated_label_1: attribute_1: asdasdasd attribute_2: 1233123
Best of luck!