-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* IBX-8006: Fixed matrix field resolving based on content's origin * added thrown exceptions
- Loading branch information
1 parent
f3f6cbf
commit bddfbfe
Showing
5 changed files
with
91 additions
and
7 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
18 changes: 18 additions & 0 deletions
18
src/lib/GraphQL/Strategy/ContentResolvingStrategyInterface.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,18 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\FieldTypeMatrix\GraphQL\Strategy; | ||
|
||
use Ibexa\Contracts\Core\Repository\Values\Content\Content; | ||
|
||
interface ContentResolvingStrategyInterface | ||
{ | ||
public function resolveContent(object $item): Content; | ||
|
||
public function supports(object $item): bool; | ||
} |
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,26 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\FieldTypeMatrix\GraphQL\Strategy; | ||
|
||
use Ibexa\Contracts\Core\Repository\Values\Content\Content; | ||
use Ibexa\GraphQL\Value\Item; | ||
|
||
final class ItemContentResolvingStrategy implements ContentResolvingStrategyInterface | ||
{ | ||
public function resolveContent(object $item): Content | ||
{ | ||
/** @var \Ibexa\GraphQL\Value\Item $item */ | ||
return $item->getContent(); | ||
} | ||
|
||
public function supports(object $item): bool | ||
{ | ||
return $item instanceof Item; | ||
} | ||
} |