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

WIP v2 #5

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fcc7f6f
Work in progress on abstracting include logic
zackify Feb 12, 2017
530aa87
Remove resource keys if not paginated, allow non callbacks for items
zackify Feb 12, 2017
4d4d689
use passed model instance for eagerload
zackify Feb 12, 2017
dc5d432
Add Resource Template
zackify Feb 13, 2017
9330ac0
Spelling
zackify Feb 13, 2017
13184f1
Add doc block
zackify Feb 13, 2017
ab3a3b1
Set transformer and model, add traits
zackify Feb 22, 2017
ed7654b
Updated other methods
zackify Feb 22, 2017
20e1617
Remove resource key if no pagination
zackify Feb 22, 2017
5340866
Remove controller base
zackify Feb 22, 2017
0d124e3
v2 readme
Feb 27, 2017
3b851f1
respond with item change
Feb 27, 2017
842eb06
Add policy support
zackify Mar 6, 2017
c9bd96a
Make should authorize a public property
zackify Mar 6, 2017
d1bfd85
Specifying return types.
joshforbes Mar 6, 2017
b2e7d47
The resource key needs to be null by default so that it falls through…
joshforbes Mar 6, 2017
578318a
Fixing default assignment.
joshforbes Mar 6, 2017
0bf2dd2
Cleaning up formatting.
joshforbes Mar 6, 2017
17e9940
Removing unused methods.
joshforbes Mar 6, 2017
0ae12cc
I think I like the name ‘withIncludes’ better than prepareBuilder.. a…
joshforbes Mar 6, 2017
345825d
Updating test to match new structure.
joshforbes Mar 6, 2017
97ee391
Try no key for now? ;)
zackify Mar 6, 2017
ba4c492
If the collection passed in is a builder - then grab the available in…
joshforbes Mar 12, 2017
27c7a74
Rollback the resource key changes for now.
joshforbes Mar 12, 2017
a6beb0e
Make sure the setup method takes the proper default argument.
joshforbes Mar 12, 2017
ebcd0c9
Cleanup use statements.
joshforbes Mar 12, 2017
c5fa0e7
Lets use the default serializer for this test.
joshforbes Mar 12, 2017
00cd4cc
Fixing incorrect namespace.
joshforbes Mar 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Serializers/DataArraySerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function collection($resourceKey, array $data)
*/
public function item($resourceKey, array $data)
{
if ($resourceKey === false) {
if (!$resourceKey) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this change. Few things:

  • If you do this - then the remaining lines of this file do not execute correctly.
  • Breaks some tests as we were making assertions about the expected structure of the data.
  • The way it is setup before your change allows the most configurable default (false for no key, null for data, and any value to set that as the key)
  • Your change only ever allows it to be no key or whatever value - but that is misleading as this class is called 'dataArraySerializer'. The general point of this class is to serialize with a data key unless the user overrides it.
  • I know what you are getting at - in your projects you don't ever want a 'data' key. Did you know that as it is currently setup it is as simply as doing an artisan config:publish and then changing the 'default_serializer' config option in transmit.php to 'arraySerializer'. Or alternatively make your own super simple serializer on a project by project basis and just give the path to it in the config file.

Now that I am thinking about it - I think I will update the arraySerializer class to basically do what you have here. Since even with that serializer the user would need the option to set a resourcekey when they were doing pagination.

return $data;
}

Expand Down