1 | <?php |
||
21 | class PreviewLocationProvider |
||
22 | { |
||
23 | /** @var \eZ\Publish\API\Repository\LocationService */ |
||
24 | private $locationService; |
||
25 | |||
26 | /** @var \eZ\Publish\API\Repository\ContentService */ |
||
27 | private $contentService; |
||
28 | |||
29 | /** @var \eZ\Publish\SPI\Persistence\Content\Location\Handler */ |
||
30 | private $locationHandler; |
||
31 | |||
32 | /** |
||
33 | * @param \eZ\Publish\API\Repository\LocationService $locationService |
||
34 | * @param \eZ\Publish\API\Repository\ContentService $contentService |
||
35 | * @param \eZ\Publish\SPI\Persistence\Content\Location\Handler $locationHandler |
||
36 | */ |
||
37 | public function __construct( |
||
46 | |||
47 | /** |
||
48 | * Loads the main location for $contentId. |
||
49 | * |
||
50 | * If the content does not have a location (yet), but has a Location draft, it is returned instead. |
||
51 | * Location drafts do not have an id (it is set to null), and can be tested using the isDraft() method. |
||
52 | * |
||
53 | * If the content doesn't have a location nor a location draft, null is returned. |
||
54 | * |
||
55 | * @deprecated Since 7.5.4, rather use loadMainLocationByContent. |
||
56 | * @see loadMainLocationByContent |
||
57 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException |
||
58 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
||
59 | * @param mixed $contentId |
||
60 | * |
||
61 | * @return \eZ\Publish\API\Repository\Values\Content\Location|null |
||
62 | */ |
||
63 | public function loadMainLocation($contentId) |
||
69 | |||
70 | /** |
||
71 | * Loads the main location for $content. |
||
72 | * |
||
73 | * If the content does not have a location (yet), but has a Location draft, it is returned instead. |
||
74 | * Location drafts do not have an id (it is set to null), and can be tested using the isDraft() method. |
||
75 | * |
||
76 | * If the content doesn't have a location nor a location draft, null is returned. |
||
77 | * |
||
78 | * @param \eZ\Publish\API\Repository\Values\Content\Content $content |
||
79 | * |
||
80 | * @return \eZ\Publish\API\Repository\Values\Content\Location|null |
||
81 | */ |
||
82 | public function loadMainLocationByContent(APIContent $content): ?APILocation |
||
115 | } |
||
116 |