_____  

Von: Tobias Schultze [mailto:[email protected]] 
Gesendet: Mittwoch, 23. Dezember 2009 10:49
An: '[email protected]'
Betreff: symfony unsetting deep nested embedded forms?

 

Hello,

I have a Doctrine Form (Teammatch) which consists of several Matches which
themselves have several Games.

 

So I have a recursive embedded Relation like this:

 

class TeammatchForm extends BaseTeammatchForm {

  public function configure()

  {

            $this->embedRelation('Matches');

  }

}

 

class MatchForm extends BaseMatchForm

{

  public function configure()

  {

            $this->embedRelation('Games');

  }

}

 

My problem ist, how do I unset deep nested embedded forms?

I tried the following, but it doesn't work: Read Only Error.

 

protected function doBind(array $values)

{   

    if (isset($values['Matches']))

    {

      foreach ($values['Matches'] as $matchIndex => $matchValues)

      {

        if (isset($matchValues['Games']))

        {

            foreach ($matchValues['Games'] as $gameIndex => $gameValues)

                  {

                        if ('' === trim($gameValues['team1_score']) && ''
=== trim($gameValues['team2_score']))

                      {

 
unset($values['Matches'][$matchIndex]['Games'][$gameIndex]);

 
unset($this['Matches'][$matchIndex]['Games'][$gameIndex]);

                      }

                  }

 

        }

      }

    }   

    parent::doBind($values);

}

 

 

Something like $this->getEmbeddedForm('Matches')->getEmbeddedForm('Games');
doesn't work either.

 

Thanks for help

 

Tobias

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.


Reply via email to