eZ\Bundle\EzPublishCoreBundle\Features\Context\ContentContext::getCurrentDraft PHP Method

getCurrentDraft() public method

public getCurrentDraft ( )
    public function getCurrentDraft()
    {
        if ($this->currentDraft === null) {
            throw new RuntimeException('No current draft has been set');
        }
        return $this->currentDraft;
    }

Usage Example

 /**
  * This could belong in the content context.
  *
  * @Given /^I modify a field from the draft$/
  */
 public function iModifyAFieldFromTheDraft()
 {
     $this->contentContext->updateDraft(['name' => 'MODIFIED - ' . $this->contentContext->getCurrentDraft()->getFieldValue('name')->text]);
 }