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 #83 from moufmouf/fix_cache_issue
Fixing a cachng issue with sub-types
- Loading branch information
Showing
4 changed files
with
162 additions
and
9 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
27 changes: 27 additions & 0 deletions
27
tests/Fixtures/Integration/Controllers/ProductController.php
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,27 @@ | ||
<?php | ||
|
||
|
||
namespace TheCodingMachine\GraphQL\Controllers\Fixtures\Integration\Controllers; | ||
|
||
|
||
use Porpaginas\Arrays\ArrayResult; | ||
use Psr\Http\Message\UploadedFileInterface; | ||
use TheCodingMachine\GraphQL\Controllers\Annotations\Mutation; | ||
use TheCodingMachine\GraphQL\Controllers\Annotations\Query; | ||
use TheCodingMachine\GraphQL\Controllers\Fixtures\Integration\Models\Contact; | ||
use TheCodingMachine\GraphQL\Controllers\Fixtures\Integration\Models\Product; | ||
use TheCodingMachine\GraphQL\Controllers\Fixtures\Integration\Models\User; | ||
|
||
class ProductController | ||
{ | ||
/** | ||
* @Query() | ||
* @return Product[] | ||
*/ | ||
public function getProducts(): ArrayResult | ||
{ | ||
return new ArrayResult([ | ||
new Product('Foo', 42.0), | ||
]); | ||
} | ||
} |
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,54 @@ | ||
<?php | ||
|
||
|
||
namespace TheCodingMachine\GraphQL\Controllers\Fixtures\Integration\Models; | ||
|
||
|
||
use DateTimeInterface; | ||
use Psr\Http\Message\UploadedFileInterface; | ||
use TheCodingMachine\GraphQL\Controllers\Annotations\Field; | ||
use TheCodingMachine\GraphQL\Controllers\Annotations\Type; | ||
|
||
/** | ||
* @Type() | ||
*/ | ||
class Product | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $name; | ||
/** | ||
* @var float | ||
*/ | ||
private $price; | ||
|
||
/** | ||
* Product constructor. | ||
* @param string $name | ||
* @param float $price | ||
*/ | ||
public function __construct(string $name, float $price) | ||
{ | ||
$this->name = $name; | ||
$this->price = $price; | ||
} | ||
|
||
/** | ||
* @Field(name="name") | ||
* @return string | ||
*/ | ||
public function getName(): string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* @Field(name="price") | ||
* @return float | ||
*/ | ||
public function getPrice(): float | ||
{ | ||
return $this->price; | ||
} | ||
} |
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