Skip to content

Commit

Permalink
renamed IConventions -> Conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Nov 25, 2020
1 parent 5975a28 commit f06c30e
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Nette\Database\Conventions\AmbiguousReferenceKeyException;


interface IConventions
interface Conventions
{
/**
* Returns primary key for table.
Expand Down Expand Up @@ -40,3 +40,6 @@ function getHasManyReference(string $table, string $key): ?array;
*/
function getBelongsToReference(string $table, string $key): ?array;
}


interface_exists(IConventions::class);
4 changes: 2 additions & 2 deletions src/Database/Conventions/DiscoveredConventions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

namespace Nette\Database\Conventions;

use Nette\Database\IConventions;
use Nette\Database\Conventions;
use Nette\Database\IStructure;


/**
* Conventions based on database structure.
*/
class DiscoveredConventions implements IConventions
class DiscoveredConventions implements Conventions
{
/** @var IStructure */
protected $structure;
Expand Down
4 changes: 2 additions & 2 deletions src/Database/Conventions/StaticConventions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
namespace Nette\Database\Conventions;

use Nette;
use Nette\Database\IConventions;
use Nette\Database\Conventions;


/**
* Conventions based on static definition.
*/
class StaticConventions implements IConventions
class StaticConventions implements Conventions
{
use Nette\SmartObject;

Expand Down
8 changes: 4 additions & 4 deletions src/Database/Explorer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Explorer
/** @var IStructure */
private $structure;

/** @var IConventions */
/** @var Conventions */
private $conventions;

/** @var Nette\Caching\IStorage */
Expand All @@ -35,8 +35,8 @@ class Explorer

public function __construct(
Connection $connection,
IStructure $structure,
IConventions $conventions = null,
Structure $structure,
Conventions $conventions = null,
Nette\Caching\IStorage $cacheStorage = null
) {
$this->connection = $connection;
Expand Down Expand Up @@ -112,7 +112,7 @@ public function getStructure(): IStructure
}


public function getConventions(): IConventions
public function getConventions(): Conventions
{
return $this->conventions;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Database/Table/GroupedSelection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
namespace Nette\Database\Table;

use Nette;
use Nette\Database\Conventions;
use Nette\Database\Explorer;
use Nette\Database\IConventions;


/**
Expand All @@ -38,7 +38,7 @@ class GroupedSelection extends Selection
*/
public function __construct(
Explorer $explorer,
IConventions $conventions,
Conventions $conventions,
string $tableName,
string $column,
Selection $refTable,
Expand Down
6 changes: 3 additions & 3 deletions src/Database/Table/Selection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
namespace Nette\Database\Table;

use Nette;
use Nette\Database\Conventions;
use Nette\Database\Explorer;
use Nette\Database\IConventions;


/**
Expand All @@ -25,7 +25,7 @@ class Selection implements \Iterator, IRowContainer, \ArrayAccess, \Countable
/** @var Explorer */
protected $explorer;

/** @var IConventions */
/** @var Conventions */
protected $conventions;

/** @var Nette\Caching\Cache */
Expand Down Expand Up @@ -85,7 +85,7 @@ class Selection implements \Iterator, IRowContainer, \ArrayAccess, \Countable
*/
public function __construct(
Explorer $explorer,
IConventions $conventions,
Conventions $conventions,
string $tableName,
Nette\Caching\IStorage $cacheStorage = null
) {
Expand Down
4 changes: 2 additions & 2 deletions src/Database/Table/SqlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
namespace Nette\Database\Table;

use Nette;
use Nette\Database\Conventions;
use Nette\Database\Driver;
use Nette\Database\Explorer;
use Nette\Database\IConventions;
use Nette\Database\IStructure;
use Nette\Database\SqlLiteral;

Expand All @@ -28,7 +28,7 @@ class SqlBuilder
/** @var string */
protected $tableName;

/** @var IConventions */
/** @var Conventions */
protected $conventions;

/** @var string delimited table name */
Expand Down
5 changes: 5 additions & 0 deletions src/compatibility-intf.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
interface ISupplementalDriver
{
}
/** @deprecated use Nette\Database\Conventions */
interface IConventions
{
}
} elseif (!interface_exists(ISupplementalDriver::class)) {
class_alias(Driver::class, ISupplementalDriver::class);
class_alias(Conventions::class, IConventions::class);
}
2 changes: 1 addition & 1 deletion tests/Database.DI/DatabaseExtension.multiple.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test('', function () {
Assert::type(Nette\Database\Structure::class, $explorer->getStructure());
Assert::same($explorer->getStructure(), $container->getByType(Nette\Database\IStructure::class));
Assert::type(Nette\Database\Conventions\DiscoveredConventions::class, $explorer->getConventions());
Assert::same($explorer->getConventions(), $container->getByType(Nette\Database\IConventions::class));
Assert::same($explorer->getConventions(), $container->getByType(Nette\Database\Conventions::class));

// aliases
Assert::same($connection, $container->getService('nette.database.first'));
Expand Down

0 comments on commit f06c30e

Please sign in to comment.