/** * Copy state name to custom_state field to preserve data when state is removed * * @return void * * @PrePersist * @PreUpdate */ public function duplicateStateName() { if (!\Includes\Decorator\Utils\CacheManager::isRebuildBlock() && $this->getState() && $this->getCustomState() !== $this->getStateName()) { $this->setCustomState($this->getStateName()); } }