-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #529 from bravo-kernel/dasherize-relationships
Dasherize JSON API relationships node
- Loading branch information
Showing
24 changed files
with
457 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
namespace Crud\Test\App\Model\Entity; | ||
|
||
class NationalCapital extends \Cake\ORM\Entity | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
namespace Crud\Test\App\Model\Entity; | ||
|
||
class NationalCity extends \Cake\ORM\Entity | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace Crud\Test\App\Model\Table; | ||
|
||
class NationalCapitalsTable extends \Cake\ORM\Table | ||
{ | ||
public function initialize(array $config) | ||
{ | ||
$this->belongsTo('Countries'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace Crud\Test\App\Model\Table; | ||
|
||
class NationalCitiesTable extends \Cake\ORM\Table | ||
{ | ||
public function initialize(array $config) | ||
{ | ||
$this->belongsTo('Countries'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
tests/Fixture/JsonApi/get_country_include_all_supported_associations.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
{ | ||
"data": { | ||
"type": "countries", | ||
"id": "1", | ||
"attributes": { | ||
"code": "NL", | ||
"name": "The Netherlands" | ||
}, | ||
"relationships": { | ||
"currency": { | ||
"data": { | ||
"type": "currencies", | ||
"id": "1" | ||
}, | ||
"links": { | ||
"self": "\/currencies\/1" | ||
} | ||
}, | ||
"national-capital": { | ||
"data": { | ||
"type": "national-capitals", | ||
"id": "1" | ||
}, | ||
"links": { | ||
"self": "\/national-capitals\/1" | ||
} | ||
}, | ||
"cultures": { | ||
"data": [ | ||
{ | ||
"type": "cultures", | ||
"id": "1" | ||
} | ||
], | ||
"links": { | ||
"self": "\/cultures?country_id=1" | ||
} | ||
}, | ||
"national-cities": { | ||
"data": [ | ||
{ | ||
"type": "national-cities", | ||
"id": "1" | ||
}, | ||
{ | ||
"type": "national-cities", | ||
"id": "2" | ||
} | ||
], | ||
"links": { | ||
"self": "\/national-cities?country_id=1" | ||
} | ||
} | ||
}, | ||
"links": { | ||
"self": "\/countries\/1" | ||
} | ||
}, | ||
"included": [ | ||
{ | ||
"type": "currencies", | ||
"id": "1", | ||
"attributes": { | ||
"code": "EUR", | ||
"name": "Euro" | ||
}, | ||
"links": { | ||
"self": "\/currencies\/1" | ||
} | ||
}, | ||
{ | ||
"type": "national-capitals", | ||
"id": "1", | ||
"attributes": { | ||
"name": "Amsterdam", | ||
"description": "National capital of the Netherlands" | ||
}, | ||
"links": { | ||
"self": "\/national-capitals\/1" | ||
} | ||
}, | ||
{ | ||
"type": "cultures", | ||
"id": "1", | ||
"attributes": { | ||
"code": "nl-NL", | ||
"name": "Dutch" | ||
}, | ||
"links": { | ||
"self": "\/cultures\/1" | ||
} | ||
}, | ||
{ | ||
"type": "national-cities", | ||
"id": "1", | ||
"attributes": { | ||
"name": "Amsterdam" | ||
}, | ||
"links": { | ||
"self": "\/national-cities\/1" | ||
} | ||
}, | ||
{ | ||
"type": "national-cities", | ||
"id": "2", | ||
"attributes": { | ||
"name": "Rotterdam" | ||
}, | ||
"links": { | ||
"self": "\/national-cities\/2" | ||
} | ||
} | ||
] | ||
} |
37 changes: 37 additions & 0 deletions
37
tests/Fixture/JsonApi/get_country_include_national-capital.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"data": { | ||
"type": "countries", | ||
"id": "1", | ||
"attributes": { | ||
"code": "NL", | ||
"name": "The Netherlands" | ||
}, | ||
"relationships": { | ||
"national-capital": { | ||
"data": { | ||
"type": "national-capitals", | ||
"id": "1" | ||
}, | ||
"links": { | ||
"self": "\/national-capitals\/1" | ||
} | ||
} | ||
}, | ||
"links": { | ||
"self": "\/countries\/1" | ||
} | ||
}, | ||
"included": [ | ||
{ | ||
"type": "national-capitals", | ||
"id": "1", | ||
"attributes": { | ||
"name": "Amsterdam", | ||
"description": "National capital of the Netherlands" | ||
}, | ||
"links": { | ||
"self": "\/national-capitals\/1" | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.