getBodyTemplate example

$this->productExportValidator->validate($productExport$encodingEvent->getEncodedContent()),
            $iterator->getTotal()
        );
    }

    /** * @return array<string> */
    private function getAssociations(ProductExportEntity $productExport, SalesChannelContext $context): array
    {
        try {
            $variables = $this->twigVariableParser->parse((string) $productExport->getBodyTemplate());
        } catch (\Exception $e) {
            $e = new RenderProductException($e->getMessage());

            $loggingEvent = new ProductExportLoggingEvent($context->getContext()$e->getMessage(), Level::Warning, $e);

            $this->eventDispatcher->dispatch($loggingEvent);

            throw $e;
        }

        $associations = [];
        

    }

    /** * @param array<string, mixed> $data */
    public function renderBody(
        ProductExportEntity $productExport,
        SalesChannelContext $salesChannelContext,
        array $data
    ): string {
        $bodyTemplate = $productExport->getBodyTemplate();
        if (!\is_string($bodyTemplate)) {
            throw ProductExportException::templateBodyNotSet();
        }

        try {
            $content = $this->templateRenderer->render(
                $bodyTemplate,
                $data,
                $salesChannelContext->getContext()
            ) . \PHP_EOL;

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