eZ\Publish\Core\REST\Server\Controller\ContentType::removeContentTypeDraftFieldDefinition PHP Method

removeContentTypeDraftFieldDefinition() public method

Deletes a field definition from a content type draft.
public removeContentTypeDraftFieldDefinition ( $contentTypeId, $fieldDefinitionId, Request $request ) : eZ\Publish\Core\REST\Server\Values\NoContent
$contentTypeId
$fieldDefinitionId
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\NoContent
    public function removeContentTypeDraftFieldDefinition($contentTypeId, $fieldDefinitionId, Request $request)
    {
        $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentTypeId);
        $fieldDefinition = null;
        foreach ($contentTypeDraft->getFieldDefinitions() as $fieldDef) {
            if ($fieldDef->id == $fieldDefinitionId) {
                $fieldDefinition = $fieldDef;
            }
        }
        if ($fieldDefinition === null) {
            throw new Exceptions\NotFoundException("Field definition not found: '{$request->getPathInfo()}'.");
        }
        $this->contentTypeService->removeFieldDefinition($contentTypeDraft, $fieldDefinition);
        return new Values\NoContent();
    }