Remove rating data by content object id and optionally attribute id.

@param int $contentobjectID
@param int $contentobjectAttributeId
546453
static function removeByObjectId( $contentobjectID, $contentobjectAttributeId = null )
    {
        $cond = array( 'contentobject_id' => $contentobjectID );
        if ( $contentobjectAttributeId !== null )
        {
            $cond['contentobject_attribute_id'] = $contentobjectAttributeId;
        }
        eZPersistentObject::removeObject( self::definition(), $cond );
    }
272175
public function deleteContentVersion($contentId, $versionNumber)
    {
        $versionInfo = $this->repository->getContentService()->loadVersionInfo(
            $this->repository->getContentService()->loadContentInfo($contentId),
            $versionNumber
        );

        if ($versionInfo->isPublished()) {
            throw new ForbiddenException('Version in status PUBLISHED cannot be deleted');
        }

        $this->repository->getContentService()->deleteVersion(
            $versionInfo
        );

        return new Values\NoContent();
    }
155089
function deleteStoredObjectAttribute( $contentObjectAttribute, $version = null )
    {
        $version = $contentObjectAttribute->objectVersion();
        if ( !is_null( $version ) &&
             $version->attribute( 'status' ) == eZContentObjectVersion::STATUS_PUBLISHED )
        {
            $contentObjectID = $contentObjectAttribute->attribute( 'contentobject_id' );
            $languageID = $contentObjectAttribute->attribute( 'language_id' );
            eZPersistentObject::removeObject( ezcomComment::definition(), 
                                              array( 'contentobject_id' => $contentObjectID,
                                                     'language_id' => $languageID ) );
        }
    }
1304354
public function stateAssign($contentId)
    {
        if ($this->allCleared === true || $this->isSwitchedOff()) {
            return;
        }

        $this->cache->invalidateTags(['content-' . $contentId]);
    }
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 );
    }
299634
static function remove( $objectID, $removeSubtrees = true )
    {
        eZContentCacheManager::clearContentCacheIfNeeded( $objectID );

        $object = eZContentObject::fetch( $objectID );
        if ( !is_object( $object ) )
            return false;

        // TODO: Is content cache cleared for all objects in subtree ??

        if ( $removeSubtrees )
        {
            $assignedNodes = $object->attribute( 'assigned_nodes' );
            if ( count( $assignedNodes ) == 0 )
            {
                $object->purge();
                eZContentObject::expireAllViewCache();
                return true;
            }
            $assignedNodeIDArray = array();
            foreach( $assignedNodes as $node )
            {
                $assignedNodeIDArray[] = $node->attribute( 'node_id' );
            }
            eZContentObjectTreeNode::removeSubtrees( $assignedNodeIDArray, false );
        }
        else
            $object->purge();

        return true;
    }
1283833
@Override
    public void removeItem(int itemID) {
        super.removeItem(itemID);
        ratingsItem.remove(itemID);
        itemsStats.remove(itemID);
    }
240447
function deleteStoredObjectAttribute( $contentObjectAttribute, $version = null )
    {
        $contentObjectAttributeID = $contentObjectAttribute->attribute( "id" );

        if ( isset( $this->deletedStoredObjectAttribute[ $contentObjectAttributeID ] ) )
            return;

        $db = eZDB::instance();

        /* First we remove the link between the keyword and the object
         * attribute to be removed */
        if ( $version == null )
        {
            eZPersistentObject::removeObject( eZURLObjectLink::definition(),
                                              array( 'contentobject_attribute_id' => $contentObjectAttributeID ) );

        }
        else
        {
            eZPersistentObject::removeObject( eZURLObjectLink::definition(),
                                              array( 'contentobject_attribute_id' => $contentObjectAttributeID,
                                                     'contentobject_attribute_version' => $version ) );
        }

        /* Here we figure out which which URLs are not in use at all */
        if ( $db->databaseName() == 'oracle' )
        {
            $res = $db->arrayQuery( "SELECT DISTINCT id
                                     FROM ezurl, ezurl_object_link
                                     WHERE ezurl.id = ezurl_object_link.url_id(+)
                                         AND url_id IS NULL" );
        }
        else
        {
            $res = $db->arrayQuery(" SELECT DISTINCT id
                                     FROM ezurl LEFT JOIN ezurl_object_link ON (ezurl.id  = ezurl_object_link.url_id)
                                     WHERE url_id IS NULL" );
        }

        /* And if there are some, we delete them */
        if ( count( $res ) )
        {
            $unusedUrlIDs = array();
            foreach ( $res as $record )
                $unusedUrlIDs[] = $record['id'];
            $unusedUrlIDString = implode( ', ', $unusedUrlIDs );

            $db->query( "DELETE FROM ezurl WHERE id IN ($unusedUrlIDString)" );
        }

        /* If all the versions/urls of the attribute were removed, do not try to remove them again */
        if ( $version == null )
        {
            $this->deletedStoredObjectAttribute[ $contentObjectAttributeID ] = true;
        }
    }
587289
public function delete($contentTypeId, $status)
    {
        if (Type::STATUS_DEFINED === $status && $this->contentTypeGateway->countInstancesOfType($contentTypeId)) {
            throw new BadStateException(
                '$contentTypeId',
                "ContentType with given id still has content instances and therefore can't be deleted"
            );
        }

        $this->contentTypeGateway->delete($contentTypeId, $status);

        // @todo FIXME: Return true only if deletion happened
        return true;
    }
371741
public function deleteContentTypeDraft($contentTypeId)
    {
        $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentTypeId);
        $this->contentTypeService->deleteContentType($contentTypeDraft);

        return new Values\NoContent();
    }
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);
        }
    }
269184
static function removeURLlinkList( $contentObjectAttributeID, $contentObjectAttributeVersion )
    {
        $conditions = array( 'contentobject_attribute_id' => $contentObjectAttributeID );
        if ( $contentObjectAttributeVersion !== false )
            $conditions['contentobject_attribute_version'] = $contentObjectAttributeVersion;
        eZPersistentObject::removeObject( eZURLObjectLink::definition(),
                                          $conditions );
    }
1172462
static public function removeByAttribute( $objectAttributeID, $objectAttributeVersion = null )
    {
        if ( !is_numeric( $objectAttributeID ) )
            return;

        $conditions = array( 'objectattribute_id' => (int) $objectAttributeID );
        if ( is_numeric( $objectAttributeVersion ) )
            $conditions['objectattribute_version'] = (int) $objectAttributeVersion;

        parent::removeObject( self::definition(), $conditions );
    }
647597
static function stats( $ContentObjectID )
    {
        static $cachedStats = array( 0 => null );
        if ( isset( $cachedStats[$ContentObjectID] ) )
        {
            return $cachedStats[$ContentObjectID];
        }
        else
        {
            $custom = array( array( 'operation' => 'sum( rating_count )',
                                    'name'      => 'rating_count' ) ,
                             array( 'operation' => 'avg( rating_average )',
                                    'name'      => 'rating_average' ) );
            $cond = array( 'contentobject_id' => $ContentObjectID );
            $return = self::fetchObjectList( self::definition(), array() ,$cond, null, null, false, false, $custom );

            if ( isset( $return[0]['rating_count'] ) )
                $return = $return[0];

            $cachedStats[$ContentObjectID] = $return;
        }
        return $return;
    }
148931
private function deleteTranslationFromContentObject($contentId, $languageId)
    {
        $query = $this->connection->createQueryBuilder();
        $query->update('ezcontentobject')
            // parameter for bitwise operation has to be placed verbatim (w/o binding) for this to work cross-DBMS
            ->set('language_mask', 'language_mask & ~ ' . $languageId)
            ->set('modified', ':now')
            ->where('id = :contentId')
            ->andWhere(
            // make sure removed translation is not the last one (incl. alwaysAvailable)
                $query->expr()->andX(
                    'language_mask & ~ ' . $languageId . ' <> 0',
                    'language_mask & ~ ' . $languageId . ' <> 1'
                )
            )
            ->setParameter(':now', time())
            ->setParameter(':contentId', $contentId)
        ;

        $rowCount = $query->execute();

        // no rows updated means that most likely somehow it was the last remaining translation
        if ($rowCount === 0) {
            throw new BadStateException(
                '$languageCode',
                'Specified translation is the only one Content Object Version has'
            );
        }
    }
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) : [];
    }
107092
public function cancelContentId($contentId)
    {
        $params = array();
        $params['action'] = 'cancleContentIdAction';
        $params['appkey'] = $this->appkey;
        $params['contentId'] = $contentId;
        $rep = $this->httpPostJSON($this->host, $params);
        return (string)$rep['result'] === 'ok';
    }