Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/marshaller #69

Closed
wants to merge 2 commits into from
Closed

Feat/marshaller #69

wants to merge 2 commits into from

Conversation

soyuka
Copy link
Owner

@soyuka soyuka commented Jan 30, 2023

Q A
Branch? main for features / current stable version branch for bug fixes
Bug fix? yes/no
New feature? yes/no
Deprecations? yes/no
Tickets Fix #...
License MIT
Doc PR api-platform/docs#...


$context = new Context(
new TypeOption(
gettype($controllerResult)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gettype($controllerResult)
get_class($controllerResult)

);

$input = new InputStream();
fwrite($input->resource(), json_encode($data));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? , what is $data ?

$dataDeserialized = $this->marshaller->unmarshal(
$input,
AttributeResource::class,
'json',
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: how to use jsonld ?

$event->setResponse(new Response(
$controllerResult,
if(
\gettype($controllerResult) === 'string'
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_string?

@Byidi Byidi force-pushed the feat/marshaller branch 2 times, most recently from 815fc71 to d7e00c5 Compare January 30, 2023 13:42

return new AttributeResources(new AttributeResource(1, 'Foo'), new AttributeResource(2, 'Bar'));
return new Collection(new AttributeResource(1, 'Foo'), new AttributeResource(2, 'Bar'));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: revert

? \gettype($controllerResult)
: \get_class($controllerResult)
),
);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: remove this

  • add a proxy for @id etc.

}

return $resource;
return new AttributeResource($uriVariables['identifier'], 'Foo');
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: revert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants