Skip to content

Commit a5b4357

Browse files
authored
[Documents] Add missing document types (#1076)
* add missing document types * Apply php-cs-fixer changes
1 parent 799339c commit a5b4357

22 files changed

Lines changed: 1021 additions & 5 deletions

config/data_index.yaml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,18 @@ services:
3535

3636
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\DocumentHydratorInterface:
3737
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\DocumentHydrator
38-
38+
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\EmailHydratorInterface:
39+
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\EmailHydrator
40+
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\FolderHydratorInterface:
41+
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\FolderHydrator
42+
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\LinkHydratorInterface:
43+
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\LinkHydrator
44+
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\HardlinkHydratorInterface:
45+
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\HardlinkHydrator
46+
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\PageHydratorInterface:
47+
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\PageHydrator
48+
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\SnippetHydratorInterface:
49+
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\SnippetHydrator
3950
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\PermissionsHydratorInterface:
4051
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\PermissionsHydrator
4152

@@ -78,7 +89,6 @@ services:
7889
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Provider\AssetQueryProvider
7990

8091
# Data Objects
81-
8292
Pimcore\Bundle\StudioBackendBundle\DataIndex\Adapter\DataObjectSearchAdapterInterface:
8393
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Adapter\DataObjectSearchAdapter
8494

@@ -118,4 +128,9 @@ services:
118128
class: Symfony\Component\DependencyInjection\ServiceLocator
119129
tags: [ 'container.service_locator' ]
120130
arguments:
121-
- Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Folder: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\DocumentHydratorInterface'
131+
- Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Email: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\EmailHydratorInterface'
132+
Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Folder: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\FolderHydratorInterface'
133+
Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\HardLink: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\HardlinkHydratorInterface'
134+
Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Link: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\LinkHydratorInterface'
135+
Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Page: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\PageHydratorInterface'
136+
Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Snippet: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document\SnippetHydratorInterface'
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document;
15+
16+
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Email as Item;
17+
use Pimcore\Bundle\StudioBackendBundle\Document\Schema\Type\Email;
18+
use Pimcore\Bundle\StudioBackendBundle\Document\Service\HydratorServiceInterface;
19+
20+
/**
21+
* @internal
22+
*/
23+
final readonly class EmailHydrator implements EmailHydratorInterface
24+
{
25+
public function __construct(
26+
private HydratorServiceInterface $hydratorService,
27+
) {
28+
}
29+
30+
public function hydrate(Item $item): Email
31+
{
32+
return new Email(
33+
$item->getSubject(),
34+
$item->getFrom(),
35+
$item->getReplyTo(),
36+
$item->getTo(),
37+
$item->getCc(),
38+
$item->getBcc(),
39+
...$this->hydratorService->getBasePageSnippetData($item),
40+
...$this->hydratorService->getBaseDocumentData($item)
41+
);
42+
}
43+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document;
15+
16+
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Email as Item;
17+
use Pimcore\Bundle\StudioBackendBundle\Document\Schema\Type\Email;
18+
19+
/**
20+
* @internal
21+
*/
22+
interface EmailHydratorInterface
23+
{
24+
public function hydrate(Item $item): Email;
25+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document;
15+
16+
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\HardLink as Item;
17+
use Pimcore\Bundle\StudioBackendBundle\Document\Schema\Type\Hardlink;
18+
use Pimcore\Bundle\StudioBackendBundle\Document\Service\HydratorServiceInterface;
19+
20+
/**
21+
* @internal
22+
*/
23+
final readonly class HardlinkHydrator implements HardlinkHydratorInterface
24+
{
25+
public function __construct(
26+
private HydratorServiceInterface $hydratorService,
27+
) {
28+
}
29+
30+
public function hydrate(Item $item): Hardlink
31+
{
32+
return new Hardlink(
33+
$item->getSourceId(),
34+
$item->isPropertiesFromSource(),
35+
$item->isChildrenFromSource(),
36+
...$this->hydratorService->getBaseDocumentData($item)
37+
);
38+
}
39+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document;
15+
16+
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\HardLink as Item;
17+
use Pimcore\Bundle\StudioBackendBundle\Document\Schema\Type\Hardlink;
18+
19+
/**
20+
* @internal
21+
*/
22+
interface HardlinkHydratorInterface
23+
{
24+
public function hydrate(Item $item): Hardlink;
25+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document;
15+
16+
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Link as Item;
17+
use Pimcore\Bundle\StudioBackendBundle\Document\Schema\Type\Link;
18+
use Pimcore\Bundle\StudioBackendBundle\Document\Service\HydratorServiceInterface;
19+
20+
/**
21+
* @internal
22+
*/
23+
final readonly class LinkHydrator implements LinkHydratorInterface
24+
{
25+
public function __construct(
26+
private HydratorServiceInterface $hydratorService,
27+
) {
28+
}
29+
30+
public function hydrate(Item $item): Link
31+
{
32+
return new Link(
33+
$item->getInternal(),
34+
$item->getInternalType(),
35+
$item->getDirect(),
36+
$item->getLinktype(),
37+
$item->getHref(),
38+
...$this->hydratorService->getBaseDocumentData($item)
39+
);
40+
}
41+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document;
15+
16+
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Link as Item;
17+
use Pimcore\Bundle\StudioBackendBundle\Document\Schema\Type\Link;
18+
19+
/**
20+
* @internal
21+
*/
22+
interface LinkHydratorInterface
23+
{
24+
public function hydrate(Item $item): Link;
25+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document;
15+
16+
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Page as Item;
17+
use Pimcore\Bundle\StudioBackendBundle\Document\Schema\Type\Page;
18+
use Pimcore\Bundle\StudioBackendBundle\Document\Service\HydratorServiceInterface;
19+
20+
/**
21+
* @internal
22+
*/
23+
final readonly class PageHydrator implements PageHydratorInterface
24+
{
25+
public function __construct(
26+
private HydratorServiceInterface $hydratorService,
27+
) {
28+
}
29+
30+
public function hydrate(Item $item): Page
31+
{
32+
return new Page(
33+
$item->getTitle(),
34+
$item->getDescription(),
35+
$item->getPrettyUrl(),
36+
...$this->hydratorService->getBasePageSnippetData($item),
37+
...$this->hydratorService->getBaseDocumentData($item)
38+
);
39+
}
40+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document;
15+
16+
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Page as Item;
17+
use Pimcore\Bundle\StudioBackendBundle\Document\Schema\Type\Page;
18+
19+
/**
20+
* @internal
21+
*/
22+
interface PageHydratorInterface
23+
{
24+
public function hydrate(Item $item): Page;
25+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Document;
15+
16+
use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Snippet as Item;
17+
use Pimcore\Bundle\StudioBackendBundle\Document\Schema\Type\Snippet;
18+
use Pimcore\Bundle\StudioBackendBundle\Document\Service\HydratorServiceInterface;
19+
20+
/**
21+
* @internal
22+
*/
23+
final readonly class SnippetHydrator implements SnippetHydratorInterface
24+
{
25+
public function __construct(
26+
private HydratorServiceInterface $hydratorService,
27+
) {
28+
}
29+
30+
public function hydrate(Item $item): Snippet
31+
{
32+
return new Snippet(
33+
...$this->hydratorService->getBasePageSnippetData($item),
34+
...$this->hydratorService->getBaseDocumentData($item)
35+
);
36+
}
37+
}

0 commit comments

Comments
 (0)