eZ\Publish\Core\Persistence\Legacy\Content\StorageHandler::deleteFieldData PHP Method

deleteFieldData() public method

Deletes data for field $ids from external storage of $fieldType.
public deleteFieldData ( string $fieldType, eZ\Publish\SPI\Persistence\Content\VersionInfo $versionInfo, array $ids )
$fieldType string
$versionInfo eZ\Publish\SPI\Persistence\Content\VersionInfo
$ids array
    public function deleteFieldData($fieldType, VersionInfo $versionInfo, array $ids)
    {
        $this->storageRegistry->getStorage($fieldType)->deleteFieldData($versionInfo, $ids, $this->context);
    }

Usage Example

 /**
  * Applies the action to the given $content.
  *
  * @param int $contentId
  */
 public function apply($contentId)
 {
     $versionNumbers = $this->contentGateway->listVersionNumbers($contentId);
     $fieldIdSet = array();
     $nameRows = $this->contentGateway->loadVersionedNameData(array_map(function ($versionNo) use($contentId) {
         return array('id' => $contentId, 'version' => $versionNo);
     }, $versionNumbers));
     foreach ($versionNumbers as $versionNo) {
         $contentRows = $this->contentGateway->load($contentId, $versionNo);
         $contentList = $this->contentMapper->extractContentFromRows($contentRows, $nameRows);
         $content = $contentList[0];
         $versionFieldIdSet = array();
         foreach ($content->fields as $field) {
             if ($field->fieldDefinitionId == $this->fieldDefinition->id) {
                 $fieldIdSet[$field->id] = true;
                 $versionFieldIdSet[$field->id] = true;
             }
         }
         // Delete from external storage with list of IDs per version
         $this->storageHandler->deleteFieldData($this->fieldDefinition->fieldType, $content->versionInfo, array_keys($versionFieldIdSet));
     }
     // Delete from internal storage -- field is always deleted from _all_ versions
     foreach (array_keys($fieldIdSet) as $fieldId) {
         $this->contentGateway->deleteField($fieldId);
     }
 }
All Usage Examples Of eZ\Publish\Core\Persistence\Legacy\Content\StorageHandler::deleteFieldData