Skip to content

Commit c92e66f

Browse files
committed
add resolver for config group and cs cache resolver
1 parent e23076f commit c92e66f

File tree

4 files changed

+153
-0
lines changed

4 files changed

+153
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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\ClassificationStore;
18+
19+
use Pimcore\Model\DataObject\Classificationstore\GroupConfig;
20+
use Pimcore\Model\DataObject\Classificationstore\KeyConfig;
21+
22+
interface DefinitionCacheResolverInterface
23+
{
24+
public function get(
25+
int $id,
26+
string $type = 'key'
27+
): ?KeyConfig;
28+
29+
public function put(GroupConfig|KeyConfig $config): void;
30+
31+
public function clear(GroupConfig|KeyConfig|null $config): void;
32+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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\ClassificationStore;
18+
19+
20+
use Pimcore\Model\DataObject\Classificationstore\DefinitionCache;
21+
use Pimcore\Model\DataObject\Classificationstore\GroupConfig;
22+
use Pimcore\Model\DataObject\Classificationstore\KeyConfig;
23+
24+
/**
25+
* @internal
26+
*/
27+
final class DefinitionCacheResolverResolver implements DefinitionCacheResolverInterface
28+
{
29+
public function get(
30+
int $id,
31+
string $type = 'key'
32+
): ?KeyConfig {
33+
return DefinitionCache::get($id, $type);
34+
}
35+
36+
public function put(GroupConfig|KeyConfig $config): void
37+
{
38+
DefinitionCache::put($config);
39+
}
40+
41+
public function clear(GroupConfig|KeyConfig|null $config): void
42+
{
43+
DefinitionCache::clear($config);
44+
}
45+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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\ClassificationStore;
18+
19+
use Exception;
20+
use Pimcore\Model\DataObject\Classificationstore\GroupConfig;
21+
22+
/**
23+
* @internal
24+
*/
25+
final class GroupConfigResolver implements GroupConfigResolverInterface
26+
{
27+
public function getById(int $id, ?bool $force = false): ?GroupConfig
28+
{
29+
return GroupConfig::getById($id, $force);
30+
}
31+
32+
/**
33+
* @throws Exception
34+
*/
35+
public function getByName(string $name, int $storeId = 1, ?bool $force = false): ?GroupConfig
36+
{
37+
return GroupConfig::getByName($name, $storeId, $force);
38+
}
39+
40+
public static function create(): GroupConfig
41+
{
42+
return GroupConfig::create();
43+
}
44+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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\ClassificationStore;
18+
19+
use Exception;
20+
use Pimcore\Model\DataObject\Classificationstore\GroupConfig;
21+
22+
interface GroupConfigResolverInterface
23+
{
24+
public function getById(int $id, ?bool $force = false): ?GroupConfig;
25+
26+
/**
27+
* @throws Exception
28+
*/
29+
public function getByName(string $name, int $storeId = 1, ?bool $force = false): ?GroupConfig;
30+
31+
public static function create(): GroupConfig;
32+
}

0 commit comments

Comments
 (0)