Remove all joins linked to a specific attachment.

@return boolean
271
public function removeAttachmentJoins()
    {
        $joinProto = $this->modelFactory()->get(Join::class);

        $loader = $this->collectionLoader();
        $loader
            ->setModel($joinProto)
            ->addFilter('object_type', $this->objType())
            ->addFilter('object_id', $this->id());

        $collection = $loader->load();

        foreach ($collection as $obj) {
            $obj->delete();
        }

        return true;
    }
84069
public function removeAll() {
    $storage = $this->entityTypeManager->getStorage('openy_pef_gxp_mapping');

    $query = $storage->getQuery('openy_pef_gxp_mapping');
    $ids = $query->execute();
    if (!$ids) {
      return;
    }

    $this->removeByChunk($ids);
  }
529593
function pruneLinks()
    {
        $this->files->ensureDirExists($this->sitesPath(), user());

        $this->files->removeBrokenLinksAt($this->sitesPath());
    }
626230
public function clear()
    {
        $cachePath   = $this->options['path'];
        $cachePrefix = $this->options['prefix'] ? $this->options['prefix'].DIRECTORY_SEPARATOR : '';
        $files       = (array) glob($cachePath.$cachePrefix.'*');

        foreach ($files as $file) {
            if (is_dir($file)) {
                $matches = glob($file.'/*.php');
                if (is_array($matches)) {
                    array_map('unlink', $matches);
                }
                rmdir($file);
            } else {
                $this->unlink($file);
            }
        }

        return true;
    }
343226
public function remove()
    {
        $returnValue = (bool) false;

        
        $db = core_kernel_classes_DbWrapper::singleton();
        if (false === $db->exec("DELETE FROM statements WHERE modelid = ?", array($this->getModelId()))){
        	$returnValue = false;
        }
        else{
        	if (false === $db->exec("DELETE FROM models WHERE modelid = ?", array($this->getModelId()))){
        		$returnValue = false;
        	}
        	else{
        		$returnValue = true;
        	}
        }
        
        

        return (bool) $returnValue;
    }
1327095
def clear(self):
        
        for attachment in self.__attachments:
            if attachment.on_cloud:
                self.__removed_attachments.append(attachment)
        self.__attachments = []
        self._update_parent_attachments()
        self._track_changes()
92029
protected function _deleteFile()
    {
        if (!$this->isUploaded()) {
            return false;
        }
        $sHash = $this->oxfiles__oxstorehash->value;
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $iCount = $oDb->getOne(
            'SELECT COUNT(*) FROM `oxfiles` WHERE `OXSTOREHASH` = ' . $oDb->quote($sHash)
        );
        if (!$iCount) {
            $sPath = $this->getStoreLocation();
            unlink($sPath);
        }
    }
889139
public function remove_file()
    {
        if ($this->is_physically_present() && is_writable($this->getRealPath())) {
            unlink($this->getRealPath());

            $this->delete_data_from_cache();

            $permalink = $this->get_permalink();

            if ($permalink instanceof media_Permalink_Adapter) {
                $permalink->delete_data_from_cache();
            }

            $this->markPhysicallyUnavailable();
        }

        return $this;
    }
439648
public function delete()
    {
        // delete the file (and previous versions of files)
        $filesToDelete = array();
        $storageFolder = $this->getStorageFolder();

        if (file_exists($storageFolder)) {
            if ($handle = opendir($storageFolder)) {
                while (false !== ($entry = readdir($handle))) {
                    // only delete if filename starts the the relevant ID
                    if (strpos($entry, $this->ID.'~') === 0) {
                        $filesToDelete[] = $entry;
                    }
                }

                closedir($handle);

                //delete all this files that have the id of this document
                foreach ($filesToDelete as $file) {
                    $filePath = $storageFolder .DIRECTORY_SEPARATOR . $file;

                    if (is_file($filePath)) {
                        unlink($filePath);
                    }
                }
            }
        }

        // get rid of any versions have saved for this DMSDocument, too
        if (DMSDocument_versions::$enable_versions) {
            $versions = $this->getVersions();

            if ($versions->Count() > 0) {
                foreach ($versions as $v) {
                    $v->delete();
                }
            }
        }

        return parent::delete();
    }
992745
function removeThis()
    {
        if ( ($this->objectCount() > 0) or ($this->classCount() > 0) )
        {
            return false;
        }

        $this->remove();

        eZContentCacheManager::clearAllContentCache();

        eZContentLanguage::fetchList( true );

        return true;
    }
67536
public function removeJoin($join)
    {
        if ($this->joins->contains($join)) {
            $this->joins->removeElement($join);
        }

        return $this;
    }
522528
public function preDelete()
    {
        $attId = $this->id();
        $joinProto = $this->modelFactory()->get(Join::class);
        $loader = $this->collectionLoader();
        $loader->setModel($joinProto);

        $collection = $loader->addFilter('attachment_id', $attId)->load();

        foreach ($collection as $obj) {
            $obj->delete();
        }

        return parent::preDelete();
    }
544099
private function removeOldFiles()
    {
        if ($handle = opendir($this->uploadDir)) {

            while (false !== ($file = readdir($handle))) {
                if (is_file($file)) {
                    if (filectime($this->uploadDir . $file) < (time() - $this->fileHandleTime)) {
                        unlink($this->uploadDir . $file);
                    }
                }
            }
        }
    }
1305714
public function clear()
    {
        foreach ($this->filesystem()->listContents() as $file) {
            $this->filesystem()->delete($file['path']);
        }

        return true;
    }
73256
public function drop()
    {
        $filepath = $this->file->getFilePath();

        unset($this->file);

        if (!file_exists($filepath)) {
            unlink($filepath);
        }

        return true;
    }
1226052
public function clear()
    {
        unset($this->cc);
        unset($this->bcc);
        unset($this->receivers);
        unset($this->attachments);
        unset($this->contentHTML);
        unset($this->contentPlain);
    }
129259
protected function filterChains()
    {
        foreach ($this->chains as $key => $chain) {
            $filterResult = $this->getFilterResult($key, $chain);
            if ($filterResult->isNotEmpty()) {
                $this->data->set(
                    $key,
                    $filterResult->getFilteredValue()
                );
            } else {
                $this->data->remove($key);
            }
        }
    }