Skip to content

Commit

Permalink
Add rewriteIds method to resolvers (#62)
Browse files Browse the repository at this point in the history
* add rewriteIds to resolvers

* Apply php-cs-fixer changes

---------

Co-authored-by: lukmzig <lukmzig@users.noreply.github.com>
  • Loading branch information
lukmzig and lukmzig authored Aug 7, 2024
1 parent b1a3a9b commit 6df6aed
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Models/Asset/AssetServiceResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
namespace Pimcore\Bundle\StaticResolverBundle\Models\Asset;

use Exception;
use Pimcore\Model\Asset;
use Pimcore\Model\Asset\Folder;
use Pimcore\Model\Asset\Service;

Expand All @@ -25,6 +26,11 @@
*/
final class AssetServiceResolver implements AssetServiceResolverInterface
{
public function rewriteIds(Asset $asset, array $rewriteConfig): Asset
{
return Service::rewriteIds($asset, $rewriteConfig);
}

/**
* @throws Exception
*/
Expand Down
3 changes: 3 additions & 0 deletions src/Models/Asset/AssetServiceResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@

namespace Pimcore\Bundle\StaticResolverBundle\Models\Asset;

use Pimcore\Model\Asset;
use Pimcore\Model\Asset\Folder;

interface AssetServiceResolverInterface
{
public function rewriteIds(Asset $asset, array $rewriteConfig): Asset;

public function createFolderByPath(string $path, array $options = []): Folder;

public function pathExists(string $path, string $type = null): bool;
Expand Down
6 changes: 6 additions & 0 deletions src/Models/DataObject/DataObjectServiceResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
namespace Pimcore\Bundle\StaticResolverBundle\Models\DataObject;

use Exception;
use Pimcore\Model\DataObject\AbstractObject;
use Pimcore\Model\DataObject\Folder;
use Pimcore\Model\DataObject\Service;

Expand All @@ -37,6 +38,11 @@ public function useInheritedValues(
);
}

public function rewriteIds(AbstractObject $object, array $rewriteConfig, array $params = []): AbstractObject
{
return Service::rewriteIds($object, $rewriteConfig, $params);
}

/**
* @throws Exception
*/
Expand Down
3 changes: 3 additions & 0 deletions src/Models/DataObject/DataObjectServiceResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

namespace Pimcore\Bundle\StaticResolverBundle\Models\DataObject;

use Pimcore\Model\DataObject\AbstractObject;
use Pimcore\Model\DataObject\Folder;

interface DataObjectServiceResolverInterface
Expand All @@ -26,5 +27,7 @@ public function useInheritedValues(
array $fnArgs = []
): mixed;

public function rewriteIds(AbstractObject $object, array $rewriteConfig, array $params = []): AbstractObject;

public function createFolderByPath(string $path, array $options = []): Folder;
}
10 changes: 10 additions & 0 deletions src/Models/Document/DocumentServiceResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,24 @@
namespace Pimcore\Bundle\StaticResolverBundle\Models\Document;

use Exception;
use Pimcore\Model\Document;
use Pimcore\Model\Document\Folder;
use Pimcore\Model\Document\PageSnippet;
use Pimcore\Model\Document\Service;

/**
* @internal
*/
final class DocumentServiceResolver implements DocumentServiceResolverInterface
{
public function rewriteIds(
Document $document,
array $rewriteConfig,
array $params = []
): Document|PageSnippet {
return Service::rewriteIds($document, $rewriteConfig, $params);
}

/**
* @throws Exception
*/
Expand Down
8 changes: 8 additions & 0 deletions src/Models/Document/DocumentServiceResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@

namespace Pimcore\Bundle\StaticResolverBundle\Models\Document;

use Pimcore\Model\Document;
use Pimcore\Model\Document\Folder;
use Pimcore\Model\Document\PageSnippet;

interface DocumentServiceResolverInterface
{
public function rewriteIds(
Document $document,
array $rewriteConfig,
array $params = []
): Document|PageSnippet;

public function createFolderByPath(string $path, array $options = []): Folder;
}

0 comments on commit 6df6aed

Please sign in to comment.