|
@@ -6,7 +6,6 @@ use Doctrine\ORM\EntityManager;
|
|
|
use Doctrine\ORM\EntityRepository;
|
|
|
use DHCPBundle\Entity\DHCP;
|
|
|
use KeaBundle\Interfaces\KeaConfigInterface;
|
|
|
-use WebserviceBundle\Services\Webservice;
|
|
|
|
|
|
class KeaConfigService
|
|
|
{
|
|
@@ -27,21 +26,28 @@ class KeaConfigService
|
|
|
private $hostRepository;
|
|
|
|
|
|
/**
|
|
|
- * @var Webservice
|
|
|
+ * @var array
|
|
|
*/
|
|
|
- private $webService;
|
|
|
-
|
|
|
+ private $databaseConfig;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
- * @param Webservice $ws
|
|
|
* @param EntityManager $em
|
|
|
+ * @param string $databaseUser
|
|
|
+ * @param string $databasePassword
|
|
|
*/
|
|
|
- public function __construct(Webservice $ws, EntityManager $em)
|
|
|
+ public function __construct(EntityManager $em, $databaseUser, $databasePassword)
|
|
|
{
|
|
|
$this->dhcpRepository = $em->getRepository('DHCPBundle:DHCP');
|
|
|
$this->subnetRepository = $em->getRepository('IPv4Bundle:SubNet');
|
|
|
$this->hostRepository = $em->getRepository('HostBundle:Host');
|
|
|
- $this->webService = $ws;
|
|
|
+
|
|
|
+ $this->databaseConfig = [
|
|
|
+ 'host' => 'mysql',
|
|
|
+ 'name' => 'kea',
|
|
|
+ 'user' => $databaseUser,
|
|
|
+ 'password' => $databasePassword,
|
|
|
+ ];
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -63,6 +69,7 @@ class KeaConfigService
|
|
|
'hosts' => $this->hostRepository->findAll(),
|
|
|
'subnets' => $this->subnetRepository->findAll(),
|
|
|
'library' => $library,
|
|
|
+ 'db' => $this->databaseConfig,
|
|
|
];
|
|
|
$config = $keaConfig->getConfig($data);
|
|
|
}
|