Skip to content

Documentation lacking - Want to use this bundle but, frustrating #4

@symball

Description

@symball

Hello,

This is quite a good bundle and i've been trying to use it over the course of a few days but, find the documentation seriously lacking when it comes to packaging up resources. Would it be possible to please add some further documentation on actual use cases or even an example project to follow with a particular emphasis on packaging data for transmission.

Right now, I've figured out creating JsonResource then returning it in a DocumentResponse which works fine for simple things but, i'm not even sure that's correct. How do i actually add relationships, etc.? I see lots of models to base things from but, there is no clear path on actual usage.

Is there a simpler way of achieving the following from the requesthandler for example?

// Use serializer to create simple resource
$travelPointSerialized = $this->serializer->toArray($travelPoint,
                SerializationContext::create()->setGroups(['Detail'])
        );
        $dataResource =  new JsonResource(
            'TravelPoints',
            $travelPoint->getId(),
            $travelPointSerialized
        );
        return new DocumentResponse($dataResource);  

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions