plugin/claco-form/Serializer/CategorySerializer.php
public function serialize(Category $category, array $options = [])
    {
        $serialized = [
            'id' => $category->getUuid(),
            'name' => $category->getName(),
            'details' => $category->getDetails(),
        ];

        if (!in_array(Options::SERIALIZE_MINIMAL, $options)) {
            $serialized = array_merge($serialized, [
                'managers' => array_map(function (User $manager) {
                    return $this->userSerializer->serialize($manager, [Options::SERIALIZE_MINIMAL]);
                }, $category->getManagers()),
            ]);
            $serialized = array_merge($serialized, [
                'fieldsValues' => array_map(function (FieldChoiceCategory $fcc) {
                    return $this->fieldChoiceCategorySerializer->serialize($fcc);
                }, $this->fieldChoiceCategoryRepo->findBy(['category' => $category])),
            ]);
        }

        return $serialized;
    }
public function serialize(Category $category, array $options = [])
    {
        $serialized = [
            'id' => $category->getUuid(),
            'name' => $category->getName(),
            'details' => $category->getDetails(),
        ];

        if (!in_array(Options::SERIALIZE_MINIMAL, $options)) {
            $serialized = array_merge($serialized, [
                'managers' => array_map(function (User $manager) {
                    return $this->userSerializer->serialize($manager, [Options::SERIALIZE_MINIMAL]);
                }, $category->getManagers()),
            ]);
            $serialized = array_merge($serialized, [
                'fieldsValues' => array_map(function (FieldChoiceCategory $fcc) {
                    return $this->fieldChoiceCategorySerializer->serialize($fcc);
                }, $this->fieldChoiceCategoryRepo->findBy(['category' => $category])),
            ]);
        }

        return $serialized;
    }
public function serialize ( Category $ category , array $ options = [ ] ) { $ serialized = [ 'id' => $ category -> getUuid ( ) , 'name' => $ category -> getName ( ) , 'details' => $ category -> getDetails ( ) , ] ; if ( ! in_array ( Options :: SERIALIZE_MINIMAL , $ options ) ) { $ serialized = array_merge ( $ serialized , [ 'managers' => array_map ( function ( User $ manager ) { return $ this -> userSerializer -> serialize ( $ manager , [ Options :: SERIALIZE_MINIMAL ] ) ; } , $ category -> getManagers ( ) ) , ] ) ; $ serialized = array_merge ( $ serialized , [ 'fieldsValues' => array_map ( function ( FieldChoiceCategory $ fcc ) { return $ this -> fieldChoiceCategorySerializer -> serialize ( $ fcc ) ; } , $ this -> fieldChoiceCategoryRepo -> findBy ( [ 'category' => $ category ] ) ) , ] ) ; } return $ serialized ; }
Serializes a Category entity for the JSON api.

@param Category $category - the category to serialize
@param array    $options  - a list of serialization options

@return array - the serialized representation of the category
Serializes a Category entity for the JSON api .