eZ\Publish\Core\REST\Common\Output\Visitor::visitValueObject PHP Method

visitValueObject() public method

Can be called by sub-visitors to visit nested objects.
public visitValueObject ( object $data ) : mixed
$data object
return mixed
    public function visitValueObject($data)
    {
        $this->valueObjectVisitorDispatcher->setOutputGenerator($this->generator);
        $this->valueObjectVisitorDispatcher->setOutputVisitor($this);
        return $this->valueObjectVisitorDispatcher->visit($data);
    }

Usage Example

Exemplo n.º 1
0
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     if ($data instanceof LocationQueryValue) {
         $rootObjectElement = 'LocationQuery';
     } else {
         if ($data instanceof ContentQueryValue) {
             $rootObjectElement = 'ContentQuery';
         } else {
             throw new Exceptions\InvalidArgumentException("ViewInput Query", "No content nor location query found in ViewInput");
         }
     }
     $generator->startObjectElement($rootObjectElement, 'Query');
     if (isset($data->filter)) {
         $generator->startHashElement('Filter');
         $visitor->visitValueObject($data->filter);
         $generator->endHashElement('Filter');
     }
     if (isset($data->query)) {
         $generator->startHashElement('Query');
         $visitor->visitValueObject($data->query);
         $generator->endhashElement('Query');
     }
     // $generator->startObjectElement('SortClauses');
     // foreach ($data->sortClauses as $sortClause) {
     //     $visitor->visitValueObject($sortClause);
     // }
     // $generator->endObjectElement('SortClauses');
     $generator->endObjectElement($rootObjectElement);
 }
All Usage Examples Of eZ\Publish\Core\REST\Common\Output\Visitor::visitValueObject