Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contracts example #75

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ Interfaces in this bundle are not intended to be implemented by third-party deve
- [Resolver Service Usage](doc/02_Resolver_Service_Usage.md)
- [Event Proxy Service Usage (deprecated)](doc/03_Event_Proxy_Service_Usage.md)
- [Interceptor Proxy Service Usage](doc/03_Interceptor_Proxy_Service_Usage.md)
- [Proxy Service Usage](doc/04_Proxy_Service_Usage.md)
- [Proxy Service Usage](doc/04_Proxy_Service_Usage.md)
- [Upgrade Notes](doc/02_Upgrade_Notes/README.md)
4 changes: 4 additions & 0 deletions doc/02_Upgrade_Notes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Upgrade notes

## 2.0.0
All Resolver classes and interfaces will be marked as `@internal`
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.0'
services:
php-static-resolver-bundle:
image: pimcore/pimcore:php8.2-debug-dev
Expand Down
43 changes: 43 additions & 0 deletions src/Db/Contracts/DbResolverContract.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?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\Db\Contracts;

use Doctrine\DBAL\Connection;
use Pimcore\Db;

class DbResolverContract implements DbResolverContractInterface
{
public function getConnection(): Connection
{
return Db::getConnection();
}

public function reset(): Connection
{
return Db::reset();
}

public function get(): Connection
{
return Db::get();
}

public function close(): void
{
Db::close();
}
}
30 changes: 30 additions & 0 deletions src/Db/Contracts/DbResolverContractInterface.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\Db\Contracts;

use Doctrine\DBAL\Connection;

interface DbResolverContractInterface
{
public function getConnection(): Connection;

public function reset(): Connection;

public function get(): Connection;

public function close(): void;
}
26 changes: 4 additions & 22 deletions src/Db/DbResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,10 @@

namespace Pimcore\Bundle\StaticResolverBundle\Db;

use Doctrine\DBAL\Connection;
use Pimcore\Db;
use Pimcore\Bundle\StaticResolverBundle\Db\Contracts\DbResolverContract;

class DbResolver implements DbResolverInterface
// @internal
final class DbResolver extends DbResolverContract implements DbResolverInterface
{
public function getConnection(): Connection
{
return Db::getConnection();
}

public function reset(): Connection
{
return Db::reset();
}

public function get(): Connection
{
return Db::get();
}

public function close(): void
{
Db::close();
}
//Add new methods here
}
13 changes: 4 additions & 9 deletions src/Db/DbResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,10 @@

namespace Pimcore\Bundle\StaticResolverBundle\Db;

use Doctrine\DBAL\Connection;
use Pimcore\Bundle\StaticResolverBundle\Db\Contracts\DbResolverContractInterface;

interface DbResolverInterface
// @internal
interface DbResolverInterface extends DbResolverContractInterface
{
public function getConnection(): Connection;

public function reset(): Connection;

public function get(): Connection;

public function close(): void;
//Add new methods here
}
3 changes: 3 additions & 0 deletions src/Lib/Cache/RuntimeCacheResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

use Pimcore\Cache\RuntimeCache;

/**
* @internal
*/
final class RuntimeCacheResolver implements RuntimeCacheResolverInterface
{
public function load(string $id): mixed
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/Cache/RuntimeCacheResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

namespace Pimcore\Bundle\StaticResolverBundle\Lib\Cache;

/**
* @internal
*/
interface RuntimeCacheResolverInterface
{
public function load(string $id): mixed;
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/CacheResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
use DateInterval;
use Pimcore\Cache;

/**
* @internal
*/
final class CacheResolver implements CacheResolverInterface
{
public function save(
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/CacheResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

use DateInterval;

/**
* @internal
*/
interface CacheResolverInterface
{
public function save(
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/ConfigResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

use Exception;

/**
* @internal
*/
interface ConfigResolverInterface
{
public function locateConfigFile(string $name): string;
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/DocumentResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
use Exception;
use Pimcore\Document\Adapter;

/**
* @internal
*/
interface DocumentResolverInterface
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/Helper/MailResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
use Pimcore\Mail;
use Pimcore\Model\Document;

/**
* @internal
*/
final class MailResolver implements MailResolverInterface
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/Helper/MailResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
use Pimcore\Mail;
use Pimcore\Model\Document;

/**
* @internal
*/
interface MailResolverInterface
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/PimcoreResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

use Pimcore;

/**
* @internal
*/
final class PimcoreResolver implements PimcoreResolverInterface
{
public function inDevMode(): bool
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/PimcoreResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

namespace Pimcore\Bundle\StaticResolverBundle\Lib;

/**
* @internal
*/
interface PimcoreResolverInterface
{
public function inDevMode(): bool;
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/ToolResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
use Pimcore\Mail;
use Pimcore\Tool;

/**
* @internal
*/
final class ToolResolver implements ToolResolverInterface
{
public function getValidLanguages(): array
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/ToolResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
use Exception;
use Pimcore\Mail;

/**
* @internal
*/
interface ToolResolverInterface
{
public function getValidLanguages(): array;
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/Tools/AdminResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

use Pimcore\Model\User;

/**
* @internal
*/
interface AdminResolverInterface
{
public function reorderWebsiteLanguages(
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/Tools/Authentication/AuthenticationResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
use Pimcore\Tool\Authentication;
use Symfony\Component\HttpFoundation\Request;

/**
* @internal
*/
final class AuthenticationResolver implements AuthenticationResolverInterface
{
public function authenticateSession(Request $request = null): ?User
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
use Pimcore\Model\User;
use Symfony\Component\HttpFoundation\Request;

/**
* @internal
*/
interface AuthenticationResolverInterface
{
public function authenticateSession(Request $request = null): ?User;
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/VideoResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
use Pimcore\Video;
use Pimcore\Video\Adapter;

/**
* @internal
*/
final class VideoResolver implements VideoResolverInterface
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Lib/VideoResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
use Exception;
use Pimcore\Video\Adapter;

/**
* @internal
*/
interface VideoResolverInterface
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Models/Asset/AssetResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
use Pimcore\Model\Asset;
use Pimcore\Model\Asset\Listing;

/**
* @internal
*/
interface AssetResolverInterface
{
public function getById(int|string $id, array $params = []): ?Asset;
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 @@ -19,6 +19,9 @@
use Pimcore\Model\Asset;
use Pimcore\Model\Asset\Folder;

/**
* @internal
*/
interface AssetServiceResolverInterface
{
public function rewriteIds(Asset $asset, array $rewriteConfig): Asset;
Expand Down
3 changes: 3 additions & 0 deletions src/Models/Asset/Image/Thumbnail/ConfigResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
use Exception;
use Pimcore\Model\Asset\Image\Thumbnail\Config;

/**
* @internal
*/
interface ConfigResolverInterface
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Models/Asset/Video/Thumbnail/ConfigResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
use Exception;
use Pimcore\Model\Asset\Video\Thumbnail\Config;

/**
* @internal
*/
interface ConfigResolverInterface
{
/**
Expand Down
5 changes: 4 additions & 1 deletion src/Models/DataObject/ClassDefinitionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
use Exception;
use Pimcore\Model\DataObject\ClassDefinition;

class ClassDefinitionResolver implements ClassDefinitionResolverInterface
/**
* @internal
*/
final class ClassDefinitionResolver implements ClassDefinitionResolverInterface
{
/**
* @throws Exception
Expand Down
3 changes: 3 additions & 0 deletions src/Models/DataObject/ClassDefinitionResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
use Exception;
use Pimcore\Model\DataObject\ClassDefinition;

/**
* @internal
*/
interface ClassDefinitionResolverInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
use Pimcore\Model\DataObject\Classificationstore\GroupConfig;
use Pimcore\Model\DataObject\Classificationstore\KeyConfig;

/**
* @internal
*/
interface DefinitionCacheResolverInterface
{
public function get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
use Exception;
use Pimcore\Model\DataObject\Classificationstore\GroupConfig;

/**
* @internal
*/
interface GroupConfigResolverInterface
{
public function getById(int $id, ?bool $force = false): ?GroupConfig;
Expand Down
Loading