Skip to content

Commit

Permalink
Updated repositories interface
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Jul 29, 2022
1 parent b06fd8a commit 71b62b4
Show file tree
Hide file tree
Showing 21 changed files with 61 additions and 82 deletions.
2 changes: 1 addition & 1 deletion src/Commands/ServiceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private function executeConnector(Style\SymfonyStyle $io, Input\InputInterface $
} else {
$connectors = [];

foreach ($this->connectorsRepository->findAll() as $connector) {
foreach ($this->connectorsRepository as $connector) {
$connectors[] = $connector->getIdentifier() . $connector->getName() ? ' [' . $connector->getName() . ']' : '';
}

Expand Down
6 changes: 1 addition & 5 deletions src/Models/DataStorage/ChannelControlsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\Metadata\Entities as MetadataEntities;
use FastyBird\Metadata\Exceptions as MetadataExceptions;
use IteratorAggregate;
use Nette;
use Ramsey\Uuid;
use RecursiveArrayIterator;
Expand All @@ -30,10 +28,8 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @implements IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IChannelControlEntity>
*/
final class ChannelControlsRepository implements IChannelControlsRepository, Countable, IteratorAggregate
final class ChannelControlsRepository implements IChannelControlsRepository
{

use Nette\SmartObject;
Expand Down
6 changes: 1 addition & 5 deletions src/Models/DataStorage/ChannelPropertiesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\DevicesModule\Exceptions;
use FastyBird\DevicesModule\Models;
use FastyBird\Metadata\Entities as MetadataEntities;
use FastyBird\Metadata\Exceptions as MetadataExceptions;
use FastyBird\Metadata\Types as MetadataTypes;
use IteratorAggregate;
use Nette;
use Nette\Utils;
use Ramsey\Uuid;
Expand All @@ -34,10 +32,8 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @implements IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IChannelStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity>
*/
final class ChannelPropertiesRepository implements IChannelPropertiesRepository, Countable, IteratorAggregate
final class ChannelPropertiesRepository implements IChannelPropertiesRepository
{

use Nette\SmartObject;
Expand Down
6 changes: 1 addition & 5 deletions src/Models/DataStorage/ChannelsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\Metadata\Entities as MetadataEntities;
use FastyBird\Metadata\Exceptions as MetadataExceptions;
use IteratorAggregate;
use Nette;
use Nette\Utils;
use Ramsey\Uuid;
Expand All @@ -31,10 +29,8 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @implements IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IChannelEntity>
*/
final class ChannelsRepository implements IChannelsRepository, Countable, IteratorAggregate
final class ChannelsRepository implements IChannelsRepository
{

use Nette\SmartObject;
Expand Down
6 changes: 1 addition & 5 deletions src/Models/DataStorage/ConnectorControlsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\Metadata\Entities as MetadataEntities;
use FastyBird\Metadata\Exceptions as MetadataExceptions;
use IteratorAggregate;
use Nette;
use Ramsey\Uuid;
use RecursiveArrayIterator;
Expand All @@ -30,10 +28,8 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @implements IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IConnectorControlEntity>
*/
final class ConnectorControlsRepository implements IConnectorControlsRepository, Countable, IteratorAggregate
final class ConnectorControlsRepository implements IConnectorControlsRepository
{

use Nette\SmartObject;
Expand Down
6 changes: 1 addition & 5 deletions src/Models/DataStorage/ConnectorPropertiesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\DevicesModule\Exceptions;
use FastyBird\DevicesModule\Models;
use FastyBird\Metadata\Entities as MetadataEntities;
use FastyBird\Metadata\Exceptions as MetadataExceptions;
use FastyBird\Metadata\Types as MetadataTypes;
use IteratorAggregate;
use Nette;
use Nette\Utils;
use Ramsey\Uuid;
Expand All @@ -34,10 +32,8 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @implements IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IConnectorStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity>
*/
final class ConnectorPropertiesRepository implements IConnectorPropertiesRepository, Countable, IteratorAggregate
final class ConnectorPropertiesRepository implements IConnectorPropertiesRepository
{

use Nette\SmartObject;
Expand Down
22 changes: 1 addition & 21 deletions src/Models/DataStorage/ConnectorsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\Metadata\Entities as MetadataEntities;
use FastyBird\Metadata\Exceptions as MetadataExceptions;
use IteratorAggregate;
use Nette;
use Nette\Utils;
use Ramsey\Uuid;
Expand All @@ -31,10 +29,8 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @implements IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IConnectorEntity>
*/
final class ConnectorsRepository implements IConnectorsRepository, Countable, IteratorAggregate
final class ConnectorsRepository implements IConnectorsRepository
{

use Nette\SmartObject;
Expand Down Expand Up @@ -93,22 +89,6 @@ public function findByIdentifier(string $identifier): ?MetadataEntities\Modules\
return null;
}

/**
* {@inheritDoc}
*
* @throws MetadataExceptions\FileNotFoundException
*/
public function findAll(): array
{
$connectors = [];

foreach ($this->rawData as $id => $entity) {
$connectors[] = $this->getEntity(Uuid\Uuid::fromString($id), $entity);
}

return $connectors;
}

/**
* {@inheritDoc}
*/
Expand Down
6 changes: 1 addition & 5 deletions src/Models/DataStorage/DeviceAttributesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\Metadata\Entities as MetadataEntities;
use FastyBird\Metadata\Exceptions as MetadataExceptions;
use IteratorAggregate;
use Nette;
use Nette\Utils;
use Ramsey\Uuid;
Expand All @@ -31,10 +29,8 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @implements IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IDeviceAttributeEntity>
*/
final class DeviceAttributesRepository implements IDeviceAttributesRepository, Countable, IteratorAggregate
final class DeviceAttributesRepository implements IDeviceAttributesRepository
{

use Nette\SmartObject;
Expand Down
6 changes: 1 addition & 5 deletions src/Models/DataStorage/DeviceControlsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\Metadata\Entities as MetadataEntities;
use FastyBird\Metadata\Exceptions as MetadataExceptions;
use IteratorAggregate;
use Nette;
use Ramsey\Uuid;
use RecursiveArrayIterator;
Expand All @@ -30,10 +28,8 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @implements IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IDeviceControlEntity>
*/
final class DeviceControlsRepository implements IDeviceControlsRepository, Countable, IteratorAggregate
final class DeviceControlsRepository implements IDeviceControlsRepository
{

use Nette\SmartObject;
Expand Down
6 changes: 1 addition & 5 deletions src/Models/DataStorage/DevicePropertiesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\DevicesModule\Exceptions;
use FastyBird\DevicesModule\Models;
use FastyBird\Metadata\Entities as MetadataEntities;
use FastyBird\Metadata\Exceptions as MetadataExceptions;
use FastyBird\Metadata\Types as MetadataTypes;
use IteratorAggregate;
use Nette;
use Nette\Utils;
use Ramsey\Uuid;
Expand All @@ -34,10 +32,8 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @implements IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IDeviceStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IDeviceMappedPropertyEntity>
*/
final class DevicePropertiesRepository implements IDevicePropertiesRepository, Countable, IteratorAggregate
final class DevicePropertiesRepository implements IDevicePropertiesRepository
{

use Nette\SmartObject;
Expand Down
6 changes: 1 addition & 5 deletions src/Models/DataStorage/DevicesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\Metadata\Entities as MetadataEntities;
use FastyBird\Metadata\Exceptions as MetadataExceptions;
use IteratorAggregate;
use Nette;
use Nette\Utils;
use Ramsey\Uuid;
Expand All @@ -31,10 +29,8 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @implements IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IDeviceEntity>
*/
final class DevicesRepository implements IDevicesRepository, Countable, IteratorAggregate
final class DevicesRepository implements IDevicesRepository
{

use Nette\SmartObject;
Expand Down
6 changes: 5 additions & 1 deletion src/Models/DataStorage/IChannelControlsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\Metadata\Entities as MetadataEntities;
use IteratorAggregate;
use Ramsey\Uuid;

/**
Expand All @@ -25,8 +27,10 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @extends IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IChannelControlEntity>
*/
interface IChannelControlsRepository
interface IChannelControlsRepository extends Countable, IteratorAggregate
{

/**
Expand Down
6 changes: 5 additions & 1 deletion src/Models/DataStorage/IChannelPropertiesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\Metadata\Entities as MetadataEntities;
use IteratorAggregate;
use Ramsey\Uuid;

/**
Expand All @@ -25,8 +27,10 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @extends IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IChannelStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IChannelMappedPropertyEntity>
*/
interface IChannelPropertiesRepository
interface IChannelPropertiesRepository extends Countable, IteratorAggregate
{

/**
Expand Down
6 changes: 5 additions & 1 deletion src/Models/DataStorage/IChannelsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\Metadata\Entities as MetadataEntities;
use IteratorAggregate;
use Ramsey\Uuid;

/**
Expand All @@ -25,8 +27,10 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @extends IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IChannelEntity>
*/
interface IChannelsRepository
interface IChannelsRepository extends Countable, IteratorAggregate
{

/**
Expand Down
6 changes: 5 additions & 1 deletion src/Models/DataStorage/IConnectorControlsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\Metadata\Entities as MetadataEntities;
use IteratorAggregate;
use Ramsey\Uuid;

/**
Expand All @@ -25,8 +27,10 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @extends IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IConnectorControlEntity>
*/
interface IConnectorControlsRepository
interface IConnectorControlsRepository extends Countable, IteratorAggregate
{

/**
Expand Down
6 changes: 5 additions & 1 deletion src/Models/DataStorage/IConnectorPropertiesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

namespace FastyBird\DevicesModule\Models\DataStorage;

use Countable;
use FastyBird\Metadata\Entities as MetadataEntities;
use IteratorAggregate;
use Ramsey\Uuid;

/**
Expand All @@ -25,8 +27,10 @@
* @subpackage Models
*
* @author Adam Kadlec <adam.kadlec@fastybird.com>
*
* @extends IteratorAggregate<int, MetadataEntities\Modules\DevicesModule\IConnectorStaticPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorDynamicPropertyEntity|MetadataEntities\Modules\DevicesModule\IConnectorMappedPropertyEntity>
*/
interface IConnectorPropertiesRepository
interface IConnectorPropertiesRepository extends Countable, IteratorAggregate
{

/**
Expand Down
Loading

0 comments on commit 71b62b4

Please sign in to comment.