ExtendedProductEntity example

$serializer = new Serializer([new StructNormalizer()][new JsonEncoder()]);

        $encoded = (new StructEncoder($this->getChainRegistry($registry)$serializer))->encode($productnew ResponseFields(null));

        static::assertArrayNotHasKey('cheapestPrice', $encoded);
        static::assertArrayHasKey('name', $encoded);
        static::assertEquals('test', $encoded['name']);
    }

    public function testNoneMappedFieldsAreNotExposed(): void
    {
        $product = new ExtendedProductEntity();
        $product->internalSetEntityData('product', new FieldVisibility([]));

        $product->setName('test');
        $registry = new StaticDefinitionInstanceRegistry(
            [SalesChannelProductDefinition::class],
            $this->createMock(ValidatorInterface::class),
            $this->createMock(EntityWriteGatewayInterface::class)
        );

        $serializer = new Serializer([new StructNormalizer()][new JsonEncoder()]);

        
Home | Imprint | This part of the site doesn't use cookies.