Skip to content

Conversation

@lindyhopchris
Copy link
Member

Allow developers to use the exact JSON API field name as the relationship method name on their
adapters, plus for default conversion of names in include paths. Although we recommend following
the PSR1 standard of using camel case for method names, this does allow a developer to use snake
case field names with snake case method names.

Closes #315

Although developers should follow the PSR1 standard of camel
casing method names, there are some developers who follow
the Eloquent attribute standard of snake casing attributes
when defining relationships.

This commit allows an adapter to have its relation method name
in exactly the same format as the JSON API field name. I.e.
a field name of `user_history` and a relation method called
`user_history`.

Otherwise it falls back to the PSR1 standard and expects the
method name to be the camel case version of the field name.

See #315 for discussion.
Adds a property on the includes models trait so that camel casing
of include path segments can be disabled. Note that the default
behaviour will remaing to camel case these as PSR1 says that
method names on classes must be camel case.

See #315
@lindyhopchris lindyhopchris added this to the 1.x milestone Mar 18, 2019
@lindyhopchris lindyhopchris merged commit bef8dd9 into develop Mar 18, 2019
@lindyhopchris lindyhopchris deleted the issue315 branch March 18, 2019 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants