Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
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;