Skip to content

Commit 7a2eb0a

Browse files
authored
[Task] Add Pimcore resolver and some other methods (#67)
* add pimcore resolver and some other methods * Apply php-cs-fixer changes --------- Co-authored-by: lukmzig <[email protected]>
1 parent 5105d5e commit 7a2eb0a

File tree

8 files changed

+143
-0
lines changed

8 files changed

+143
-0
lines changed

src/Lib/PimcoreResolver.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* Pimcore
6+
*
7+
* This source file is available under two different licenses:
8+
* - GNU General Public License version 3 (GPLv3)
9+
* - Pimcore Commercial License (PCL)
10+
* Full copyright and license information is available in
11+
* LICENSE.md which is distributed with this source code.
12+
*
13+
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
14+
* @license http://www.pimcore.org/license GPLv3 and PCL
15+
*/
16+
17+
namespace Pimcore\Bundle\StaticResolverBundle\Lib;
18+
19+
use Pimcore;
20+
21+
final class PimcoreResolver implements PimcoreResolverInterface
22+
{
23+
public function inDevMode(): bool
24+
{
25+
return Pimcore::inDevMode();
26+
}
27+
28+
public function inAdmin(): bool
29+
{
30+
return Pimcore::inAdmin();
31+
}
32+
33+
public function setAdminMode(): void
34+
{
35+
Pimcore::setAdminMode();
36+
}
37+
38+
public function unsetAdminMode(): void
39+
{
40+
Pimcore::unsetAdminMode();
41+
}
42+
43+
public function isInstalled(): bool
44+
{
45+
return Pimcore::isInstalled();
46+
}
47+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* Pimcore
6+
*
7+
* This source file is available under two different licenses:
8+
* - GNU General Public License version 3 (GPLv3)
9+
* - Pimcore Commercial License (PCL)
10+
* Full copyright and license information is available in
11+
* LICENSE.md which is distributed with this source code.
12+
*
13+
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
14+
* @license http://www.pimcore.org/license GPLv3 and PCL
15+
*/
16+
17+
namespace Pimcore\Bundle\StaticResolverBundle\Lib;
18+
19+
interface PimcoreResolverInterface
20+
{
21+
public function inDevMode(): bool;
22+
23+
public function inAdmin(): bool;
24+
25+
public function setAdminMode(): void;
26+
27+
public function unsetAdminMode(): void;
28+
29+
public function isInstalled(): bool;
30+
}

src/Models/DataObject/DataObjectResolver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,9 @@ public function getTypes(): array
4747
{
4848
return DataObject::getTypes();
4949
}
50+
51+
public function setHideUnpublished(bool $hideUnpublished): void
52+
{
53+
DataObject::setHideUnpublished($hideUnpublished);
54+
}
5055
}

src/Models/DataObject/DataObjectResolverInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ public function getByPath(string $path, array $params = []): ?DataObject;
2828
public function getList(array $config = []): Listing;
2929

3030
public function getTypes(): array;
31+
32+
public function setHideUnpublished(bool $hideUnpublished): void;
3133
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* Pimcore
6+
*
7+
* This source file is available under two different licenses:
8+
* - GNU General Public License version 3 (GPLv3)
9+
* - Pimcore Commercial License (PCL)
10+
* Full copyright and license information is available in
11+
* LICENSE.md which is distributed with this source code.
12+
*
13+
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
14+
* @license http://www.pimcore.org/license GPLv3 and PCL
15+
*/
16+
17+
namespace Pimcore\Bundle\StaticResolverBundle\Models\DataObject;
18+
19+
use Pimcore\Model\DataObject\Localizedfield;
20+
21+
/**
22+
* @internal
23+
*/
24+
final class LocalizedFieldResolver implements LocalizedFieldResolverInterface
25+
{
26+
public function setGetFallbackValues(bool $getFallbackValues): void
27+
{
28+
Localizedfield::setGetFallbackValues($getFallbackValues);
29+
}
30+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* Pimcore
6+
*
7+
* This source file is available under two different licenses:
8+
* - GNU General Public License version 3 (GPLv3)
9+
* - Pimcore Commercial License (PCL)
10+
* Full copyright and license information is available in
11+
* LICENSE.md which is distributed with this source code.
12+
*
13+
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
14+
* @license http://www.pimcore.org/license GPLv3 and PCL
15+
*/
16+
17+
namespace Pimcore\Bundle\StaticResolverBundle\Models\DataObject;
18+
19+
interface LocalizedFieldResolverInterface
20+
{
21+
public function setGetFallbackValues(bool $getFallbackValues): void;
22+
}

src/Models/Document/DocumentResolver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,9 @@ public function getTypes(): array
5252
{
5353
return Document::getTypes();
5454
}
55+
56+
public function setHideUnpublished(bool $hideUnpublished): void
57+
{
58+
Document::setHideUnpublished($hideUnpublished);
59+
}
5560
}

src/Models/Document/DocumentResolverInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ public function create(int $parentId, array $data = [], bool $save = true): Docu
3030
public function getList(array $config = []): Listing;
3131

3232
public function getTypes(): array;
33+
34+
public function setHideUnpublished(bool $hideUnpublished): void;
3335
}

0 commit comments

Comments
 (0)