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

implemented file upload capability #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JardanDuarte
Copy link

No description provided.

Copy link
Owner

@mghoneimy mghoneimy left a comment

Choose a reason for hiding this comment

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

Besides the code level comments I have added, we still need:

  1. Unit tests to cover new functionality added
  2. A GraphQL API server to be able to test this feature against as an integration test

@@ -81,11 +81,13 @@ public function __construct(
* @param Query|QueryBuilderInterface $query
* @param bool $resultsAsArray
* @param array $variables
* @param array $variables
Copy link
Owner

Choose a reason for hiding this comment

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

why do we have duplicate $variable definition in docblock?

Comment on lines +130 to +139
foreach ($files as $key => $content) {
$map->{$key} = [
$content['path']
];

$postDataFields[$key] = [
'name' => $key,
'contents' => fopen($content['file'], 'r'),
];
}
Copy link
Owner

Choose a reason for hiding this comment

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

Please define a new class File to be used to pass file data instead of passing them as array fields.

@mghoneimy mghoneimy mentioned this pull request Mar 14, 2021
@ben221199
Copy link

A GraphQL API server to be able to test this feature against as an integration test

Monday.com supports files: https://monday.com/developers/v2#mutations-section-add-file-to-column

$request = $request->withBody(Psr7\stream_for(json_encode($bodyArray)));

if (!$files) {
$request = $request->withBody(Psr7\stream_for(json_encode($bodyArray)));

Choose a reason for hiding this comment

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

This couples Guzzle tightly to the client. I think stream discovery should be used here. For example with php-http/discovery's \Http\Discovery\Psr17FactoryDiscovery:

\Http\Discovery\Psr17FactoryDiscovery::findStreamFactory()->createStream(\json_encode($bodyArray));

@NickStallman
Copy link

Lighthouse also supports file uploads. https://lighthouse-php.com/master/digging-deeper/file-uploads.html#handling-file-uploads

It's been awhile since this PR has had any activity. It would be good to get this merged.

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.

None yet

5 participants