Throoze
Throoze

Reputation: 4038

Symfonian way to unset embedded forms

I would like to check if there are blank embedded forms into my form, and delete the old ones from my database, and unset the new ones, so the validators don't consider them....

what I'm doing is to unset() the forms i don't want to consider,, but I was wondering if there is any better symfonian way to do it... I've seen the code of sfForm.class.php, but didn't find a method just the opposite to embbedForm()

Any ideas? do I have to use unset()?

Upvotes: 0

Views: 72

Answers (1)

Vlad Jula-Nedelcu
Vlad Jula-Nedelcu

Reputation: 1696

Use it without worries.
Just like you did to unset form fields in the older symfony versions (fx unset($this['name']). Newer versions have introduced a method useFields($array), but you can still use the unset function.
As you can see here here, you can use it to unset an array element. And symfony's sfForm implements ArrayAccess.

Upvotes: 1

Related Questions