MyEntityDefinition example

$entity->setName('test');
        $entity->setDescription('test');
        $entity->setTranslated([
            'name' => 'test',
            'description' => 'test',
        ]);

        $registry = $this->createMock(DefinitionRegistryChain::class);
        $registry->method('has')
            ->willReturn(true);

        $definition = new MyEntityDefinition();
        $definition->compile(
            $this->getContainer()->get(DefinitionInstanceRegistry::class)
        );

        $registry->method('getByEntityName')
            ->willReturn($definition);

        $encoder = new StructEncoder(
            $registry,
            $this->getContainer()->get('serializer')
        );

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