mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
BUGFIX: fixed ghost records existing on the live site when editing draft
This commit is contained in:
parent
379bcc7921
commit
2fd0883ea1
@ -107,6 +107,15 @@ class UserDefinedForm extends Page {
|
||||
* @return void
|
||||
*/
|
||||
public function doPublish() {
|
||||
// remove fields on the live table which could have been orphaned.
|
||||
$live = Versioned::get_by_stage("EditableFormField", "Live", "`EditableFormField`.ParentID = $this->ID");
|
||||
if($live) {
|
||||
foreach($live as $field) {
|
||||
$field->deleteFromStage('Live');
|
||||
}
|
||||
}
|
||||
|
||||
// publish the draft pages
|
||||
if($this->Fields()) {
|
||||
foreach($this->Fields() as $field) {
|
||||
$field->publish('Stage', 'Live');
|
||||
|
Loading…
Reference in New Issue
Block a user