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

BC Break: Add method to convert patched document to array #43

Open
Konafets opened this issue Jun 21, 2017 · 2 comments
Open

BC Break: Add method to convert patched document to array #43

Konafets opened this issue Jun 21, 2017 · 2 comments

Comments

@Konafets
Copy link

I think it is very common to convert the patched document to an array afterwards. This given, it would be nice to add a method which handles this within the lib.

I imagine an API like

$patchedArray = (new Patch($targetDocument, $patchDocument))->apply()->toArray();
$patchedDocument = (new Patch($targetDocument, $patchDocument))->apply()->toJson();

This implies that apply() does just return $this.

If this is a valuable feature I will add a PR.

@lifewcody
Copy link

I +1 this feature because I currently use:
json_decode($patch->apply());
So a toArray() and toJson() via returning $this; would be very helpful

@raphaelstolt
Copy link
Owner

As this got a +1 I would accept a PR implementing this.

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

No branches or pull requests

3 participants