eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\LocationList::visit PHP Method

visit() public method

Visit struct returned by controllers.
public visit ( Visitor $visitor, Generator $generator, LocationList $data )
$visitor eZ\Publish\Core\REST\Common\Output\Visitor
$generator eZ\Publish\Core\REST\Common\Output\Generator
$data eZ\Publish\Core\REST\Server\Values\LocationList
    public function visit(Visitor $visitor, Generator $generator, $data)
    {
        $generator->startObjectElement('LocationList');
        $visitor->setHeader('Content-Type', $generator->getMediaType('LocationList'));
        $generator->startAttribute('href', $data->path);
        $generator->endAttribute('href');
        $generator->startList('Location');
        foreach ($data->locations as $restLocation) {
            $generator->startObjectElement('Location');
            $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadLocation', array('locationPath' => trim($restLocation->location->pathString, '/'))));
            $generator->endAttribute('href');
            $generator->endObjectElement('Location');
        }
        $generator->endList('Location');
        $generator->endObjectElement('LocationList');
    }
LocationList