Add BC compatibility for getters
If a migration to new columns wasn't executed correctly, we want to be sure that getters return the correct value. [MAILPOET-3910]
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
namespace MailPoet\Entities;
|
||||
|
||||
use MailPoet\Segments\DynamicSegments\Filters\UserRole;
|
||||
use MailPoetVendor\Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
@ -56,10 +57,22 @@ class DynamicSegmentFilterData {
|
||||
}
|
||||
|
||||
public function getFilterType(): ?string {
|
||||
return $this->filterType;
|
||||
if ($this->filterType) {
|
||||
return $this->filterType;
|
||||
}
|
||||
// When a new column is empty, we try to get the value from serialized data
|
||||
return $filterData['segmentType'] ?? null;
|
||||
}
|
||||
|
||||
public function getAction(): ?string {
|
||||
return $this->action;
|
||||
if ($this->action) {
|
||||
return $this->action;
|
||||
}
|
||||
// When a new column is empty, we try to get the value from serialized data
|
||||
// BC compatibility, the wordpress user role segment didn't have action
|
||||
if ($this->getFilterType() === self::TYPE_USER_ROLE && !isset($this->filterData['action'])) {
|
||||
return UserRole::TYPE;
|
||||
}
|
||||
return $this->filterData['action'] ?? null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user