Skip to content

Commit 3511161

Browse files
committed
fix: doPublish has been deprecated in Versioned (#62)
1 parent ca5c023 commit 3511161

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Extension/BaseElementExtension.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ public function onBeforeDelete()
243243
$firstVirtual = $this->getVirtualElements()->First();
244244
$wasPublished = false;
245245
}
246+
246247
if ($firstVirtual) {
247248
$clone = $this->owner->duplicate(false);
248249

@@ -251,9 +252,11 @@ public function onBeforeDelete()
251252
$clone->Sort = $firstVirtual->Sort;
252253

253254
$clone->write();
255+
254256
if ($wasPublished) {
255-
$clone->doPublish();
256-
$firstVirtual->doUnpublish();
257+
$clone->publishRecursive();
258+
259+
$firstVirtual->doArchive();
257260
}
258261

259262
// clone has a new ID, so need to repoint
@@ -262,14 +265,18 @@ public function onBeforeDelete()
262265
if ($virtual->ID == $firstVirtual->ID) {
263266
continue;
264267
}
268+
265269
$pub = false;
270+
266271
if ($virtual->isPublished()) {
267272
$pub = true;
268273
}
274+
269275
$virtual->LinkedElementID = $clone->ID;
270276
$virtual->write();
277+
271278
if ($pub) {
272-
$virtual->doPublish();
279+
$virtual->publishRecursive();
273280
}
274281
}
275282

0 commit comments

Comments
 (0)