Skip to content

Commit f4fd7c8

Browse files
committed
GQL-48: Implementing a hack to enable the InlineFragment to select a Query inside
- Introduced a common parent class for both that has the method setAsNested - Implemented method in InlineFragment as a stub - Added new feature to the changelog
1 parent a9099d6 commit f4fd7c8

File tree

4 files changed

+43
-4
lines changed

4 files changed

+43
-4
lines changed

Changelog.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@
33
The change log describes what is "Added", "Removed", "Changed" or "Fixed"
44
between each release.
55

6-
## 2019-07-24
6+
## Tech Debt
7+
8+
- Refactor the query conversion to string to separate the process of constructing a query and adding a field
9+
10+
## 1.3: 2019-08-03
11+
12+
### Added
13+
14+
- Support for inline fragments in the package
15+
16+
## 1.2: 2019-07-24
717

818
### Added
919

src/InlineFragment.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* @package GraphQL
99
*/
10-
class InlineFragment
10+
class InlineFragment extends NestableObject
1111
{
1212
use FieldTrait;
1313

@@ -40,4 +40,14 @@ public function __toString()
4040
{
4141
return sprintf(static::FORMAT, $this->typeName, $this->constructSelectionSet());
4242
}
43+
44+
/**
45+
* @codeCoverageIgnore
46+
*
47+
* @return mixed|void
48+
*/
49+
protected function setAsNested()
50+
{
51+
// TODO: Remove this method, it's purely tech debt
52+
}
4353
}

src/NestableObject.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace GraphQL;
4+
5+
/**
6+
* Class NestableObject
7+
*
8+
* @codeCoverageIgnore
9+
*
10+
* @package GraphQL
11+
*/
12+
abstract class NestableObject
13+
{
14+
// TODO: Remove this method and class entirely, it's purely tech debt
15+
/**
16+
* @return mixed
17+
*/
18+
protected abstract function setAsNested();
19+
}

src/Query.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
* @package GraphQL
1313
*/
14-
class Query
14+
class Query extends NestableObject
1515
{
1616
use FieldTrait;
1717

@@ -232,7 +232,7 @@ protected function generateSignature(): string
232232
/**
233233
*
234234
*/
235-
private function setAsNested()
235+
protected function setAsNested()
236236
{
237237
$this->isNested = true;
238238
}

0 commit comments

Comments
 (0)