<?php

class BandMembersForm extends sfForm
{
  protected 
$band;

  protected 
$count;

  public function 
__construct(Band $band$count null)
  {
    
$this->band $band;
    
$this->count $count;

    
parent::__construct();
  }

  public function 
configure()
  {
    
$i 0;

    foreach (
$this->band->Members as $member)
    {
      
$this->embedForm($i, new EmbeddedBandMemberForm($member));
      
$i ++;
    }

    
$count max($i 3$this->count);
    for (
$j $i$j $count$j ++)
    {
      
$this->embedForm($j, new EmbeddedBandMemberForm());
    }
  }
}