Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setTemplateName example
if
(
$entry
->
getContentText
(
)
!== null
)
{
$mail
->
setBodyText
(
$entry
->
getContentText
(
)
)
;
}
if
(
$entry
->
getContentHtml
(
)
!== null
)
{
$mail
->
setBodyHtml
(
$entry
->
getContentHtml
(
)
)
;
}
if
(
$entry
->
getType
(
)
!== null
)
{
$mail
->
setTemplateName
(
$entry
->
getType
(
)
->
getName
(
)
)
;
}
if
(
$entry
->
getOrder
(
)
!== null
)
{
$mail
->
setAssociation
(
LogEntryBuilder::ORDER_ASSOCIATION,
$entry
->
getOrder
(
)
)
;
}
if
(
$entry
->
getShop
(
)
!== null
)
{
$mail
->
setAssociation
(
LogEntryBuilder::SHOP_ASSOCIATION,
$entry
->
getShop
(
)
)
;
}
$this
->
assignOrderDocuments
(
$entry
,
$mail
)
;
$mediaService
=
Shopware
(
)
->
Container
(
)
->
get
(
MediaServiceInterface::
class
)
;
if
(
!
$mediaService
->
has
(
$attachment
->
getPath
(
)
)
)
{
Shopware
(
)
->
Container
(
)
->
get
(
'corelogger'
)
->
error
(
'Could not load file: ' .
$attachment
->
getPath
(
)
)
;
}
else
{
$fileAttachment
=
$mail
->
createAttachment
(
$mediaService
->
read
(
$attachment
->
getPath
(
)
)
)
;
$fileAttachment
->filename =
$attachment
->
getFileName
(
)
;
}
}
$mail
->
setTemplateName
(
$mailModel
->
getName
(
)
)
;
if
(
$this
->
getShop
(
)
!== null
)
{
$mail
->
setAssociation
(
LogEntryBuilder::SHOP_ID_ASSOCIATION,
$this
->
getShop
(
)
->
getId
(
)
)
;
}
return
$mail
;
}
}