Real delete a entity in object manager.

@param ResourceInterface $resource The resource
498487
protected function doDeleteResourceAction(ResourceInterface $resource): void
    {
        try {
            $this->om->remove($resource->getRealData());
        } catch (\Exception $e) {
            DomainUtil::injectErrorMessage($this->translator, $resource, $e, $this->debug);
        }
    }
1115769
public function remove($entity)
    {
        if ($this->evm->hasListeners(Events::preRemove)) {
            $this->evm->dispatchEvent(Events::preRemove, new Event\LifecycleEventArgs($entity, $this->sm));
        }

        $oid = spl_object_hash($entity);
        $this->scheduledForDelete[$oid] = $entity;

        if ($this->evm->hasListeners(Events::postRemove)) {
            $this->evm->dispatchEvent(Events::postRemove, new Event\LifecycleEventArgs($entity, $this->sm));
        }
    }
72402
protected function doDeleteResource(ResourceInterface $resource, $soft)
    {
        $skipped = false;
        $object = $resource->getRealData();

        if ($object instanceof SoftDeletableInterface) {
            if ($soft) {
                if ($object->isDeleted()) {
                    $skipped = true;
                } else {
                    $this->doDeleteResourceAction($resource);
                }
            } else {
                if (!$object->isDeleted()) {
                    $object->setDeletedAt(new \DateTime());
                }
                $this->doDeleteResourceAction($resource);
            }
        } else {
            $this->doDeleteResourceAction($resource);
        }

        return $skipped;
    }
193593
public function addResource(ResourceInterface $resource) {
		if ($this->type === RelationshipObject::TO_ONE) {
			throw new InputException('can not add a resource to a to-one relationship, use ->setResource()');
		}
		
		$this->resources[] = $resource;
	}
248618
public function equals(ResourceInterface $resource) {
		if ($this->hasIdentification() === false || $resource->getResource()->hasIdentification() === false) {
			throw new Exception('can not compare resources if identification is missing');
		}
		
		return ($this->getIdentificationKey() === $resource->getResource()->getIdentificationKey());
	}
526725
protected function hasNotBeenAdded(ResourceInterface $resource): bool
    {
        return isset($this->addedResources[$resource->getId()][$resource->getType()]) === false;
    }
1101175
public function free(EntityNodeInterface $entity)
	{
		$this->repository->free($entity);
		$this->repository = null;
	}
638968
protected function serialize(ResourceInterface $resource, $data)
    {
        // Get the serializer from the resource, or use the default.
        $serializer = $resource->getSerializer() ?? $this->getSerializer();
        
        if ($serializer instanceof SerializerInterface) {
            if ($resource instanceof Collection) {
                if ($data === null) {
                    return $serializer->nullCollection();
                }
                $data = $serializer->collection($resource->getResourceKey(), $data);
                if ($resource->hasPaginator()) {
                    $data = array_merge($data, $serializer->paginator($resource->getPaginator()));
                }
            } elseif ($resource instanceof Item) {
                if ($data === null) {
                    return $serializer->nullItem();
                }
                $data = $serializer->item($resource->getResourceKey(), $data);
            }
        } elseif (\is_callable($serializer)) {
            // Serialize via a callable/closure
            $data = $serializer($resource->getResourceKey(), $data);
        }
       
        return $data;
    }
384387
public function afterDelete(Event $event, EntityInterface $entity) {
		if ($this->_checkEvent($event)) {
			$event->result = $this->_deleteFile($event);
			$event->stopPropagation();
		}
	}
969369
public function destroy(Entity $entity)
    {
        if ($entity->isExists()) {

            // enable logical delete ?
            if ($entity->hasAttribute('active')) {
                $attributes = [];
                $attributes['active'] = 0;
                if ($entity->hasAttribute('deleted_at')) $attributes['deleted_at'] = time();
                $this->update($attributes, $entity->getPrimaryValue());
            } else {
                $this->delete($entity->getPrimaryValue());
            }
        }
    }
314425
public function delete($id)
    {
        $entity = $this->get($id);

        $this->manager->remove($entity);
        $this->manager->flush();
    }
739585
public function deleteInstances( core_kernel_classes_Class $resource, $resources, $deleteReference = false)
    {
        $returnValue = false;

        $class = new core_kernel_classes_Class($resource->getUri());
        $uris = array();
        
        foreach ($resources as $r) {
            $uri = (($r instanceof core_kernel_classes_Resource) ? $r->getUri() : $r);
            $uris[] = $this->getPersistence()->quote($uri);
        }
        
        if ($class->exists()) {
            $inValues = implode(',', $uris);
            $query = 'DELETE FROM statements WHERE subject IN (' . $inValues . ')';
        	
            if (true === $deleteReference) {
                $params[] = $resource->getUri();
                $query .= ' OR object IN (' . $inValues . ')';
            }
        	
            try {
        		// Even if now rows are affected, we consider the resources
        		// as deleted.
        		$this->getPersistence()->exec($query);	
        		$returnValue = true;
            } catch (PDOException $e) {
        	    throw new core_kernel_persistence_smoothsql_Exception("An error occured while deleting resources: " . $e->getMessage());
            }
        }

        return $returnValue;
    }
624978
private function close($resource)
    {
        if (is_resource($resource)) {
            fclose($resource);
        }

        if (is_resource($this->process)) {
            proc_close($this->process);
            $this->process = null;
        }

        $this->stdin->close();
    }
566325
public function removeResource(AbstractResourceFile $resource) {
        if (parent::offsetExists($resource->getMemberId())) {
            parent::offsetUnset($resource->getMemberId());
        }
    }
808106
public function remove($object)
    {
        // Intercept a second call for the same PersistentResource object because it might cause an endless loop caused by
        // the ResourceManager's deleteResource() method which also calls this remove() function:
        if (!$this->removedResources->contains($object)) {
            $this->removedResources->attach($object);
            parent::remove($object);
        }
    }
883166
public function setVersion(ResourceInterface $resource, $version) {
		if ($resource instanceof ResourceDocument) {
			$resource->addMeta($this->getKeyword('version'), $version, $level=Document::LEVEL_RESOURCE);
		}
		else {
			$resource->addMeta($this->getKeyword('version'), $version);
		}
	}
198743
public function deleteResource(PersistentResource $resource)
    {
        $this->s3Client->deleteObject(array(
            'Bucket' => $this->bucketName,
            'Key' => $this->keyPrefix . $resource->getSha1()
        ));
        return true;
    }