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

Add "documentFormat" option #137

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add "documentFormat" option #137

wants to merge 2 commits into from

Conversation

thomseddon
Copy link

@thomseddon thomseddon commented Aug 20, 2016

In a similar way to dateFormat/binaryFormat, this allows the user to specify the type of returned documents via the documentFormat option.

Passing 'array' will mean documents are returned as native arrays, otherwise documents will continue to be returned as ArrayObject's.

In a similar way to dateFormat/binaryFormat, this allows the user
to specify the type of returned documents via the documentFormat
option.
Passing 'array' will mean documents are returned as native arrays,
otherwise documents will continue to be returned as ArrayObject's.
@thomseddon
Copy link
Author

thomseddon commented Aug 20, 2016

Changes in ed8368d are unrelated but fixes styling errors causing the build to fail

$native = new \ArrayObject();
if (isset($opts['documentFormat']) && $opts['documentFormat'] == 'array') {
$native = array();
} else {
Copy link
Owner

Choose a reason for hiding this comment

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

I'd prefer an explicit set of allowed values. How about?

  • documentFormat not set at all
  • documentFormat == 'array'
  • documentFormat == 'object'

So the else branch should verify that documentFormat is either not isset, or that its value is 'object'. Otherwise it should throw a RqlDriverError.

Does that sound reasonable to you?

@danielmewes
Copy link
Owner

Thanks for the pull request @thomseddon ! I added one comment, but otherwise this looks good to me.

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