Skip to content

Commit

Permalink
Add settings store resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
mattamon committed Dec 5, 2023
1 parent 5fe06e6 commit e78ed3f
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/Models/Tool/SettingsStoreResolver.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StaticResolverBundle\Models\Tool;

use Exception;
use Pimcore\Model\Tool\SettingsStore;

/**
* @internal
*/
final class SettingsStoreResolver implements SettingsStoreResolverInterface
{

/**
* @throws Exception
*/
public function set(string $id, float|bool|int|string $data, string $type = 'string', ?string $scope = null): bool
{
return SettingsStore::set($id, $data, $type, $scope);
}

public function delete(string $id, ?string $scope = null): int|string
{
return SettingsStore::delete($id, $scope);
}

public function get(string $id, ?string $scope = null): ?SettingsStore
{
return SettingsStore::get($id, $scope);
}

public function getIdsByScope(string $scope): array
{
return SettingsStore::getIdsByScope($scope);
}
}
30 changes: 30 additions & 0 deletions src/Models/Tool/SettingsStoreResolverInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StaticResolverBundle\Models\Tool;

use Pimcore\Model\Tool\SettingsStore;

interface SettingsStoreResolverInterface
{
public function set(string $id, float|bool|int|string $data, string $type = 'string', ?string $scope = null): bool;

public function delete(string $id, ?string $scope = null): int|string;

public function get(string $id, ?string $scope = null): ?SettingsStore;

public function getIdsByScope(string $scope): array;
}

0 comments on commit e78ed3f

Please sign in to comment.