/** * @param Object\Concrete $object * @return Object\Concrete */ protected function getLatestVersion(Object\Concrete $object) { $modificationDate = $object->getModificationDate(); $latestVersion = $object->getLatestVersion(); if ($latestVersion) { $latestObj = $latestVersion->loadData(); if ($latestObj instanceof Object\Concrete) { $object = $latestObj; $object->setModificationDate($modificationDate); // set de modification-date from published version to compare it in js-frontend } } return $object; }
/** * @param Document|Asset|ConcreteObject $element * @return Document|Asset|ConcreteObject */ protected function getLatestVersion($element) { //TODO move this maybe to a service method, since this is also used in ObjectController and DocumentControllers if ($element instanceof Document) { $latestVersion = $element->getLatestVersion(); if ($latestVersion) { $latestDoc = $latestVersion->loadData(); if ($latestDoc instanceof Document) { $element = $latestDoc; $element->setModificationDate($element->getModificationDate()); } } } if ($element instanceof Object\Concrete) { $modificationDate = $element->getModificationDate(); $latestVersion = $element->getLatestVersion(); if ($latestVersion) { $latestObj = $latestVersion->loadData(); if ($latestObj instanceof ConcreteObject) { $element = $latestObj; $element->setModificationDate($modificationDate); } } } return $element; }