/** * Runs revert post action on content and its draft. * * @param AbstractClassContent $content * @param Revision $draft * * @return ClassContentManager */ private function revertPostProcess(AbstractClassContent $content, Revision $draft) { $data = $draft->jsonSerialize(); if (0 === count($data['parameters']) && (0 === count($data['elements']) || $content instanceof ContentSet && $data['elements']['current'] === $data['elements']['draft'])) { $this->entityManager->remove($draft); if (AbstractClassContent::STATE_NEW === $content->getState()) { $classname = AbstractClassContent::getClassnameByContentType($content->getContentType()); $this->entityManager->getRepository($classname)->deleteContent($content); } } return $this; }