Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getPublishingStoppedReason example
if
(
$this
->
checkConflictsOnTarget
(
)
)
{
throw
new
WorkspaceConflictException
(
)
;
}
$tracked_entities
=
$this
->workspaceAssociation->
getTrackedEntities
(
$this
->sourceWorkspace->
id
(
)
)
;
$event
=
new
WorkspacePrePublishEvent
(
$this
->sourceWorkspace,
$tracked_entities
)
;
$this
->eventDispatcher->
dispatch
(
$event
)
;
if
(
$event
->
isPublishingStopped
(
)
)
{
throw
new
WorkspacePublishException
(
(string)
$event
->
getPublishingStoppedReason
(
)
)
;
}
try
{
$transaction
=
$this
->database->
startTransaction
(
)
;
// @todo Handle the publishing of a workspace with a batch operation in // https://www.drupal.org/node/2958752.
$this
->workspaceManager->
executeOutsideWorkspace
(
function
D
)
use
(
$tracked_entities
)
{
foreach
(
$tracked_entities
as
$entity_type_id
=>
$revision_difference
)
{
$entity_revisions
=
$this
->entityTypeManager->
getStorage
(
$entity_type_id
)
->
loadMultipleRevisions
(
array_keys
(
$revision_difference
)
)
;
$default_revisions
=
$this
->entityTypeManager->
getStorage
(
$entity_type_id
)