Symfony\Component\Form\Form::isEmpty PHP Method

isEmpty() public method

Returns whether the form is empty.
public isEmpty ( ) : boolean
return boolean
    public function isEmpty()
    {
        foreach ($this->children as $child) {
            if (!$child->isEmpty()) {

                return false;
            }
        }

        return array() === $this->appData || null === $this->appData || '' === $this->appData;
    }

Usage Example

コード例 #1
0
 public function testIsEmptyReturnsFalseIfAnyFieldIsFilled()
 {
     $form = new Form();
     $field1 = new TestField('foo');
     $field1->setData('baz');
     $field2 = new TestField('bar');
     $field2->setData(null);
     $form->add($field1);
     $form->add($field2);
     $this->assertFalse($form->isEmpty());
 }
All Usage Examples Of Symfony\Component\Form\Form::isEmpty