eZ\Publish\Core\REST\Common\Output\ValueObjectVisitor\ContentObjectStates::visit PHP Method

visit() public method

Visit struct returned by controllers.
public visit ( Visitor $visitor, Generator $generator, ContentObjectStates $data )
$visitor eZ\Publish\Core\REST\Common\Output\Visitor
$generator eZ\Publish\Core\REST\Common\Output\Generator
$data eZ\Publish\Core\REST\Common\Values\ContentObjectStates
    public function visit(Visitor $visitor, Generator $generator, $data)
    {
        $generator->startObjectElement('ContentObjectStates');
        $visitor->setHeader('Content-Type', $generator->getMediaType('ContentObjectStates'));
        $visitor->setHeader('Accept-Patch', $generator->getMediaType('ContentObjectStates'));
        $generator->startList('ObjectState');
        foreach ($data->states as $state) {
            $generator->startObjectElement('ObjectState');
            $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadObjectState', array('objectStateGroupId' => $state->groupId, 'objectStateId' => $state->objectState->id)));
            $generator->endAttribute('href');
            $generator->endObjectElement('ObjectState');
        }
        $generator->endList('ObjectState');
        $generator->endObjectElement('ContentObjectStates');
    }
ContentObjectStates