added DomainController
Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
parent
9c87d47477
commit
7e5810a936
|
@ -50,7 +50,7 @@ class RequestController
|
|||
{
|
||||
private Logger $log;
|
||||
|
||||
//private DatabaseConnection $databaseConnection;
|
||||
private DomainController $domainController;
|
||||
private DomainRepository $domainRepository;
|
||||
private ApikeyRepository $apikeyRepository;
|
||||
private Container $container;
|
||||
|
@ -85,6 +85,9 @@ class RequestController
|
|||
$containerBuilder = new ContainerBuilder();
|
||||
$containerBuilder->addDefinitions([
|
||||
DatabaseConnection::class => autowire()->constructorParameter(parameter: 'config', value: $this->config),
|
||||
DomainController::class => autowire()
|
||||
->constructorParameter(parameter: 'config', value: $this->config)
|
||||
->constructorParameter(parameter: 'log', value: $this->log),
|
||||
DomainRepository::class => autowire()
|
||||
->constructorParameter(parameter: 'config', value: $this->config)
|
||||
->constructorParameter(parameter: 'log', value: $this->log),
|
||||
|
@ -92,6 +95,7 @@ class RequestController
|
|||
]);
|
||||
$this->container = $containerBuilder->build();
|
||||
|
||||
$this->domainController = $this->container->get(name: DomainController::class);
|
||||
$this->domainRepository = $this->container->get(name: DomainRepository::class);
|
||||
$this->apikeyRepository = $this->container->get(name: ApikeyRepository::class);
|
||||
|
||||
|
@ -356,8 +360,7 @@ class RequestController
|
|||
/**
|
||||
* @return void
|
||||
*/
|
||||
public
|
||||
function handleDomainPostRequest(): void
|
||||
public function handleDomainPostRequest(): void
|
||||
{
|
||||
$name = $_POST['name'] ?? '';
|
||||
$panel = $_POST['panel'] ?? '';
|
||||
|
@ -417,12 +420,12 @@ class RequestController
|
|||
$this->status = "404 Not Found";
|
||||
$this->message = "Domain with ID : $id doesn't exist.";
|
||||
} else {
|
||||
// TODO not required, as we rely on the ID
|
||||
$domain = new Domain(name: $name, panel: $panel, id: $id);
|
||||
$this->domainRepository->update(domain: $domain);
|
||||
$this->header = "201 Updated";
|
||||
$this->status = "201 Updated";
|
||||
$this->message = "201 Updated";
|
||||
$this->domainController->createSlaveZoneFile(domain: $domain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue