Symfony\Component\Form\FieldGroup::get PHP Метод

get() публичный Метод

Returns the field with the given key.
public get ( string $key ) : Symfony\Component\Form\FieldInterface
$key string
Результат Symfony\Component\Form\FieldInterface
    public function get($key)
    {
        if (isset($this->fields[$key])) {
            return $this->fields[$key];
        }

        throw new \InvalidArgumentException(sprintf('Field "%s" does not exist.', $key));
    }

Usage Example

Пример #1
0
 public function testMergeAddsFieldsFromAnotherGroup()
 {
     $group1 = new FieldGroup('author');
     $group1->add($field1 = new TestField('firstName'));
     $group2 = new FieldGroup('publisher');
     $group2->add($field2 = new TestField('lastName'));
     $group1->merge($group2);
     $this->assertTrue($group1->has('lastName'));
     $this->assertEquals(new PropertyPath('publisher.lastName'), $group1->get('lastName')->getPropertyPath());
 }