removeMapping example

$event = new ElasticsearchProductCustomFieldsMappingEvent(['field1' => 'text']$context);
        static::assertSame($context$event->getContext());

        static::assertSame('text', $event->getMapping('field1'));

        static::assertNull($event->getMapping('field2'));

        $event->setMapping('field2', 'text');

        static::assertSame('text', $event->getMapping('field2'));

        $event->removeMapping('field2');

        static::assertNull($event->getMapping('field2'));

        $mappings = $event->getMappings();

        static::assertEquals(
            ['field1' => 'text'],
            $mappings
        );
    }
}
Home | Imprint | This part of the site doesn't use cookies.