public function serialize(FieldFacetChoice $choice, array $options = [])
    {
        $serialized = [
          'id' => $choice->getUuid(),
          'name' => $choice->getName(),
          'label' => $choice->getName(),
          'value' => $choice->getValue(),
          'position' => $choice->getPosition(),
        ];

        if (!empty($choice->getChildren())) {
            $serialized['children'] = [];

            foreach ($choice->getChildren() as $child) {
                $serialized['children'][] = $this->serialize($child);
            }
        }

        return $serialized;
    }
public function serialize(FieldFacetChoice $choice, array $options = [])
    {
        $serialized = [
          'id' => $choice->getUuid(),
          'name' => $choice->getName(),
          'label' => $choice->getName(),
          'value' => $choice->getValue(),
          'position' => $choice->getPosition(),
        ];

        if (!empty($choice->getChildren())) {
            $serialized['children'] = [];

            foreach ($choice->getChildren() as $child) {
                $serialized['children'][] = $this->serialize($child);
            }
        }

        return $serialized;
    }
public function serialize ( FieldFacetChoice $ choice , array $ options = [ ] ) { $ serialized = [ 'id' => $ choice -> getUuid ( ) , 'name' => $ choice -> getName ( ) , 'label' => $ choice -> getName ( ) , 'value' => $ choice -> getValue ( ) , 'position' => $ choice -> getPosition ( ) , ] ; if ( ! empty ( $ choice -> getChildren ( ) ) ) { $ serialized [ 'children' ] = [ ] ; foreach ( $ choice -> getChildren ( ) as $ child ) { $ serialized [ 'children' ] [ ] = $ this -> serialize ( $ child ) ; } } return $ serialized ; }
Serializes a FieldFacetChoice entity for the JSON api.

@param FieldFacetChoice $choice  - the choice to serialize
@param array            $options - a list of serialization options

@return array - the serialized representation of the field facet
Serializes a FieldFacetChoice entity for the JSON api .