-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathLocationResolver.php
More file actions
57 lines (49 loc) · 1.53 KB
/
LocationResolver.php
File metadata and controls
57 lines (49 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace BD\EzPlatformGraphQLBundle\GraphQL\Resolver;
use eZ\Publish\API\Repository\ContentService;
use eZ\Publish\API\Repository\LocationService;
use Overblog\GraphQLBundle\Resolver\TypeResolver;
class LocationResolver
{
/**
* @var \eZ\Publish\API\Repository\LocationService
*/
private $locationService;
/**
* @var ContentService
*/
private $contentService;
public function __construct(LocationService $locationService, ContentService $contentService)
{
$this->locationService = $locationService;
$this->contentService = $contentService;
}
public function resolveLocation($args)
{
if (isset($args['id'])) {
return $this->locationService->loadLocation($args['id']);
}
}
public function resolveLocationsByContentId($contentId)
{
return $this->locationService->loadLocations(
$this->contentService->loadContentInfo($contentId)
);
}
public function resolveLocationById($locationId)
{
return $this->locationService->loadLocation($locationId);
}
public function resolveLocationChildren($args)
{
if (isset($args['id'])) {
return $this->locationService->loadLocationChildren(
$this->locationService->loadLocation($args['id']),0,10
)->locations;
}
}
}