findBy(['element' => $element], ['timestamp' => $order], $limit, $offset); } /** * Gets the last log entries ordered by timestamp. * * @param string $order * @param null $limit * @param null $offset * * @return array */ public function getLogsOrderedByTimestamp($order = 'DESC', $limit = null, $offset = null) { return $this->findBy([], ['timestamp' => $order], $limit, $offset); } /** * Gets the target element associated with the logentry. * * @return AbstractDBElement|null Returns the associated DBElement or null if the log either has no target or the element * was deleted from DB. */ public function getTargetElement(AbstractLogEntry $logEntry): ?AbstractDBElement { $class = $logEntry->getTargetClass(); $id = $logEntry->getTargetID(); if (null === $class || null === $id) { return null; } return $this->getEntityManager()->find($class, $id); } }