public function preRemove(LifecycleEventArgs $args) { $entity = $args->getEntity(); if ($this->skipCondition($entity)) { $className = strtolower($this->extractClass($entity)); if ($this->skipCondition($entity)) { $history = new History(); $history->setCreatedAt(new \DateTime()); $history->setUser($this->container->get('security.token_storage')->getToken()->getUser()); $history->setEntityCode($className); $history->setType('deleted'); $history->setEntryId($entity->getId()); $history->setLog('Entity deleted'); $this->history[] = $history; } } }