73 lines
2.2 KiB
PHP
73 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace Modules\Tasks\Infrastructure;
|
|
|
|
use Modules\Tasks\Factory as ModuleFactory;
|
|
use Modules\Tasks\Infrastructure\DBQueries\Factory as DBQueriesFactory;
|
|
use Modules\Tasks\Infrastructure\OtherQueries\Factory as OtherQueriesFactory;
|
|
use Modules\Tasks\Infrastructure\Storage\Factory as StorageFactory;
|
|
use Modules\Tasks\Infrastructure\DBPersistLayer\Factory as DBPersistLayerFactory;
|
|
|
|
class Factory
|
|
{
|
|
|
|
private ModuleFactory $moduleFactory;
|
|
|
|
private ?DBQueriesFactory $dbQueriesFactory = null;
|
|
|
|
private ?OtherQueriesFactory $otherQueriesFactory = null;
|
|
|
|
private ?StorageFactory $storageFactory = null;
|
|
|
|
private ?DBPersistLayerFactory $dbPersistLayerFactory = null;
|
|
|
|
public function setModuleFactory(ModuleFactory $moduleFactory): void
|
|
{
|
|
$this->moduleFactory = $moduleFactory;
|
|
}
|
|
|
|
public function getModuleFactory(): ModuleFactory
|
|
{
|
|
return $this->moduleFactory;
|
|
}
|
|
|
|
public function getDBQueriesFactory(): DBQueriesFactory
|
|
{
|
|
if ($this->dbQueriesFactory) {
|
|
return $this->dbQueriesFactory;
|
|
}
|
|
$this->dbQueriesFactory = new DBQueriesFactory();
|
|
$this->dbQueriesFactory->setInfrastructureFactory($this);
|
|
return $this->dbQueriesFactory;
|
|
}
|
|
|
|
public function getOtherQueriesFactory(): OtherQueriesFactory
|
|
{
|
|
if ($this->otherQueriesFactory) {
|
|
return $this->otherQueriesFactory;
|
|
}
|
|
$this->otherQueriesFactory = new OtherQueriesFactory();
|
|
return $this->otherQueriesFactory;
|
|
}
|
|
|
|
public function getStorageFactory(): StorageFactory
|
|
{
|
|
if ($this->storageFactory) {
|
|
return $this->storageFactory;
|
|
}
|
|
$this->storageFactory = new StorageFactory;
|
|
$this->storageFactory->setInfrastructureFactory($this);
|
|
return $this->storageFactory;
|
|
}
|
|
|
|
public function getDBPersistLayerFactory(): DBPersistLayerFactory
|
|
{
|
|
if ($this->dbPersistLayerFactory) {
|
|
return $this->dbPersistLayerFactory;
|
|
}
|
|
$this->dbPersistLayerFactory = new DBPersistLayerFactory;
|
|
$this->dbPersistLayerFactory->setInfrastructureFactory($this);
|
|
return $this->dbPersistLayerFactory;
|
|
}
|
|
}
|