Skip to content

Commit

Permalink
Remove the decorator and split implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
herbertroth committed Nov 29, 2024
1 parent e7bf411 commit 6209a54
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 94 deletions.
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
14 changes: 5 additions & 9 deletions src/Db/Contracts/DbResolverContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,27 @@
namespace Pimcore\Bundle\StaticResolverBundle\Db\Contracts;

use Doctrine\DBAL\Connection;
use Pimcore\Bundle\StaticResolverBundle\Db\DbResolverInterface;
use Pimcore\Db;

class DbResolverContract implements DbResolverContractInterface
{
public function __construct(private readonly DbResolverInterface $dbResolver)
{
}

public function getConnection(): Connection
{
return $this->dbResolver->getConnection();
return Db::getConnection();
}

public function reset(): Connection
{
return $this->dbResolver->reset();
return Db::reset();
}

public function get(): Connection
{
return $this->dbResolver->get();
return Db::get();
}

public function close(): void
{
$this->dbResolver->close();
Db::close();
}
}
25 changes: 3 additions & 22 deletions src/Db/DbResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,10 @@

namespace Pimcore\Bundle\StaticResolverBundle\Db;

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

// @internal
final class DbResolver implements DbResolverInterface
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
}
12 changes: 3 additions & 9 deletions src/Db/DbResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,10 @@

namespace Pimcore\Bundle\StaticResolverBundle\Db;

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

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

public function reset(): Connection;

public function get(): Connection;

public function close(): void;
//Add new methods here
}
53 changes: 0 additions & 53 deletions tests/Unit/Db/Contracts/DbResolverContractTest.php

This file was deleted.

0 comments on commit 6209a54

Please sign in to comment.