Skip to content

Commit 54d55e0

Browse files
authored
[Task] Move predefined for properties into own namespace and add metadata (#63)
* Move predefined for properties into own namespace and add metadata * add pathExists to Document and DataObject Service Resolvers
1 parent 6df6aed commit 54d55e0

File tree

8 files changed

+85
-2
lines changed

8 files changed

+85
-2
lines changed

src/Models/DataObject/DataObjectServiceResolver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,9 @@ public function createFolderByPath(string $path, array $options = []): Folder
5050
{
5151
return Service::createFolderByPath($path, $options);
5252
}
53+
54+
public function pathExists(string $path, string $type = null): bool
55+
{
56+
return Service::pathExists($path, $type);
57+
}
5358
}

src/Models/DataObject/DataObjectServiceResolverInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ public function useInheritedValues(
3030
public function rewriteIds(AbstractObject $object, array $rewriteConfig, array $params = []): AbstractObject;
3131

3232
public function createFolderByPath(string $path, array $options = []): Folder;
33+
34+
public function pathExists(string $path, string $type = null): bool;
3335
}

src/Models/Document/DocumentServiceResolver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,9 @@ public function createFolderByPath(string $path, array $options = []): Folder
4242
{
4343
return Service::createFolderByPath($path, $options);
4444
}
45+
46+
public function pathExists(string $path, string $type = null): bool
47+
{
48+
return Service::pathExists($path, $type);
49+
}
4550
}

src/Models/Document/DocumentServiceResolverInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ public function rewriteIds(
2929
): Document|PageSnippet;
3030

3131
public function createFolderByPath(string $path, array $options = []): Folder;
32+
33+
public function pathExists(string $path, string $type = null): bool;
3234
}
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+
* 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\Metadata\Predefined;
18+
19+
use Exception;
20+
use Pimcore\Model\Metadata\Predefined;
21+
22+
final class PredefinedResolver implements PredefinedResolverInterface
23+
{
24+
public function getById(string $id): ?Predefined
25+
{
26+
return Predefined::getById($id);
27+
}
28+
29+
/**
30+
* @throws Exception
31+
*/
32+
public function getByName(string $name): ?Predefined
33+
{
34+
return Predefined::getByName($name);
35+
}
36+
37+
public function create(): Predefined
38+
{
39+
return Predefined::create();
40+
}
41+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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\Metadata\Predefined;
18+
19+
use Pimcore\Model\Metadata\Predefined;
20+
21+
interface PredefinedResolverInterface
22+
{
23+
public function getById(string $id): ?Predefined;
24+
25+
public function getByName(string $name): ?Predefined;
26+
27+
public function create(): Predefined;
28+
}

src/Models/Predefined/PredefinedResolver.php renamed to src/Models/Property/Predefined/PredefinedResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @license http://www.pimcore.org/license GPLv3 and PCL
1515
*/
1616

17-
namespace Pimcore\Bundle\StaticResolverBundle\Models\Predefined;
17+
namespace Pimcore\Bundle\StaticResolverBundle\Models\Property\Predefined;
1818

1919
use Pimcore\Model\Property\Predefined;
2020

src/Models/Predefined/PredefinedResolverInterface.php renamed to src/Models/Property/Predefined/PredefinedResolverInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @license http://www.pimcore.org/license GPLv3 and PCL
1515
*/
1616

17-
namespace Pimcore\Bundle\StaticResolverBundle\Models\Predefined;
17+
namespace Pimcore\Bundle\StaticResolverBundle\Models\Property\Predefined;
1818

1919
use Pimcore\Model\Property\Predefined;
2020

0 commit comments

Comments
 (0)