Removes a content object by Id from the search database.

@since 5.0
@param int $contentObjectId the content object to remove by id
@param bool $commit Whether to commit after removing the object
@return bool True if the operation succeed.
169941
static function removeObjectById( $contentObjectId, $commit = null )
    {
        $searchEngine = eZSearch::getEngine();
        if ( $searchEngine instanceof ezpSearchEngine )
        {
            return $searchEngine->removeObjectById( $contentObjectId, $commit );
        }

        return false;
    }
275745
private function isDeletingFile( eZHTTPTool $http, eZContentObjectAttribute $contentObjectAttribute )
    {
        $isDeletingFile = false;
        if ( $http->hasPostVariable( 'CustomActionButton' ) )
        {
            $customActionArray = $http->postVariable( 'CustomActionButton' );
            $attributeID = $contentObjectAttribute->attribute( 'id' );
            if ( isset( $customActionArray[$attributeID . '_delete_binary'] ) )
            {
                $isDeletingFile = true;
            }
        }

        return $isDeletingFile;
    }
297776
public function delete($id)
    {
        $contentCount = $this->sectionGateway->countContentObjectsInSection($id);

        if ($contentCount > 0) {
            throw new RuntimeException(
                "Section with ID '{$id}' still has content assigned."
            );
        }
        $this->sectionGateway->deleteSection($id);
    }
791049
static function removeById( $attributeId, $version = null )
    {
        if ( $version !== null )
    	   $conds = array( 'contentobject_attribute_id' => $attributeId, 'contentobject_version' => $version  );
    	else
    	    $conds = array( 'contentobject_attribute_id' => $attributeId );

        eZPersistentObject::removeObject( self::definition(), $conds, null );
    }
176598
public function deleteFields($contentId, VersionInfo $versionInfo)
    {
        foreach ($this->contentGateway->getFieldIdsByType($contentId, $versionInfo->versionNo) as $fieldType => $ids) {
            $this->storageHandler->deleteFieldData($fieldType, $versionInfo, $ids);
        }
        $this->contentGateway->deleteFields($contentId, $versionInfo->versionNo);
    }
1253109
public function removeRawContent($contentId)
    {
        $this->locationGateway->removeElementFromTrash(
            $this->loadContentInfo($contentId)->mainLocationId
        );

        foreach ($this->listVersions($contentId) as $versionInfo) {
            $this->fieldHandler->deleteFields($contentId, $versionInfo);
        }
        // Must be called before deleteRelations()
        $this->contentGateway->removeReverseFieldRelations($contentId);
        $this->contentGateway->deleteRelations($contentId);
        $this->contentGateway->deleteVersions($contentId);
        $this->contentGateway->deleteNames($contentId);
        $this->contentGateway->deleteContent($contentId);
    }
1053735
public function delete($contentId)
    {
        $this->loadModel('Content.Contents');
        $content = $this->Contents->get($contentId, ['contain' => ['ContentTypes']]);

        if (!$content || empty($content->content_type)) {
            throw new ContentNotFoundException(__d('content', 'The requested page was not found.'));
        }

        if (!$content->content_type->userAllowed('translate')) {
            throw new ContentDeleteException(__d('content', 'You are not allowed to delete contents of this type ({0}).', $content->content_type->name));
        }

        if ($this->Contents->delete($content, ['atomic' => true])) {
            $this->Flash->success(__d('content', 'Content was successfully removed!'));
        } else {
            $this->Flash->danger(__d('content', 'Unable to remove this content, please try again.'));
        }

        $this->title(__d('content', 'Delete Content'));
        $this->redirect($this->referer());
    }
316619
public function deleteAction($contentTypeId)
    {
        if (0 == $this->get('open_orchestra_model.repository.content')->countByContentType($contentTypeId)) {
            $contentTypes = $this->get('open_orchestra_model.repository.content_type')->findBy(array('contentTypeId' => $contentTypeId));
            if (count($contentTypes) > 0) {
                foreach ($contentTypes as $contentType) {
                    $this->denyAccessUnlessGranted(ContributionActionInterface::DELETE, $contentType);
                }
                if (!$this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $contentTypes[0])) {
                    $this->createAccessDeniedException();
                }

                $this->get('open_orchestra_backoffice.manager.content_type')->delete($contentTypes);
                $this->dispatchEvent(ContentTypeEvents::CONTENT_TYPE_DELETE, new ContentTypeEvent($contentTypes[0]));
                $this->get('object_manager')->flush();
            }
        }

        return array();
    }
716615
protected function getContentLocationIds($contentObjectId)
    {
        $query = $this->databaseHandler->createSelectQuery();
        $query->select('node_id')
            ->from($this->databaseHandler->quoteTable(self::CONTENTOBJECT_TREE_TABLE))
            ->where($query->expr->eq('contentobject_id', $contentObjectId));
        $stmt = $query->prepare();
        $stmt->execute();
        $nodeIds = $stmt->fetchAll(PDO::FETCH_COLUMN);

        return is_array($nodeIds) ? array_map('intval', $nodeIds) : [];
    }
1116398
public function deleteContentType($contentTypeId)
    {
        $contentType = $this->contentTypeService->loadContentType($contentTypeId);

        try {
            $this->contentTypeService->deleteContentType($contentType);
        } catch (BadStateException $e) {
            throw new ForbiddenException($e->getMessage());
        }

        return new Values\NoContent();
    }
724298
public function setRelation($contentType, $id)
    {
        if (empty($this->relation[$contentType]) || !in_array($id, $this->relation[$contentType], false)) {
            $this->relation[$contentType][] = $id;
        }
    }
1261446
public function removeRole($contentId, $roleId)
    {
        try {
            return $this->innerGateway->removeRole($contentId, $roleId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
1284511
public static function fetchByContentObjectVersion( $contentObjectId, $version )
    {
        $contentObjectVersion = eZContentObjectVersion::fetchVersion( $version, $contentObjectId );
        if ( $contentObjectVersion instanceof eZContentObjectVersion )
        {
            $return = self::fetchByContentVersionId( $contentObjectVersion->attribute( 'id' ) );
            return $return;
        }
        else
        {
            return false;
        }
    }
1149577
public function deleteRelations($contentId, $versionNo = null)
    {
        $query = $this->dbHandler->createDeleteQuery();
        $query->deleteFrom(
            $this->dbHandler->quoteTable('ezcontentobject_link')
        );

        if (isset($versionNo)) {
            $query->where(
                $query->expr->lAnd(
                    $query->expr->eq(
                        $this->dbHandler->quoteColumn('from_contentobject_id'),
                        $query->bindValue($contentId, null, \PDO::PARAM_INT)
                    ),
                    $query->expr->eq(
                        $this->dbHandler->quoteColumn('from_contentobject_version'),
                        $query->bindValue($versionNo, null, \PDO::PARAM_INT)
                    )
                )
            );
        } else {
            $query->where(
                $query->expr->lOr(
                    $query->expr->eq(
                        $this->dbHandler->quoteColumn('from_contentobject_id'),
                        $query->bindValue($contentId, null, \PDO::PARAM_INT)
                    ),
                    $query->expr->eq(
                        $this->dbHandler->quoteColumn('to_contentobject_id'),
                        $query->bindValue($contentId, null, \PDO::PARAM_INT)
                    )
                )
            );
        }

        $query->prepare()->execute();
    }
156468
private function isUserContent($contentId)
    {
        try {
            $this->repository->getUserService()->loadUser($contentId);

            return true;
        } catch (NotFoundException $e) {
            return false;
        }
    }
1220374
protected function deleteRecord(Repository $repo, Content $entity)
    {
        $recordId = $entity->getId();
        /** @var Mapping\ContentType $contentType */
        $contentType = $entity->getContenttype();
        $contentTypeName = (string) $contentType;
        if (!$this->users->isAllowed("contenttype:$contentTypeName:delete:$recordId")) {
            $this->loggerFlash->error(Trans::__('general.access-denied.content-not-modified', ['%title%' => $entity->getTitle()]));

            return false;
        }
        $result = $repo->delete($entity);
        if ($result) {
            $this->loggerSystem->info(sprintf('Deleted %s: %s', $contentType['singular_name'], $entity->getTitle()), ['event' => 'content']);
            $fieldRepo = $this->em->getRepository(FieldValue::class);
            $deleteFieldQuery = $fieldRepo->createQueryBuilder()
                ->delete($fieldRepo->getTableName())
                ->where('content_id = :content_id')
                ->andWhere('contenttype= :contenttype')
                ->setParameter('content_id', $recordId)
                ->setParameter('contenttype', $contentTypeName);
            $deleteFieldQuery->execute();
        }

        return $result;
    }
1309735
public function deleteContent($contentId, $versionId = null)
    {
        // 1. Delete the Content
        if ($versionId === null) {
            $this->gateway->deleteByQuery(json_encode(['query' => ['match' => ['_id' => $contentId]]]), $this->contentDocumentTypeIdentifier);
        } else {
            $this->gateway->delete($contentId, $this->contentDocumentTypeIdentifier);
        }

        // 2. Delete all Content's Locations
        $this->gateway->deleteByQuery(json_encode(['query' => ['match' => ['content_id_id' => $contentId]]]), $this->locationDocumentTypeIdentifier);
    }