|
@@ -68,6 +68,18 @@ class KEAHostReservationSubscriber implements EventSubscriber
|
|
{
|
|
{
|
|
$entity = $args->getEntity();
|
|
$entity = $args->getEntity();
|
|
if ($entity instanceof Host) {
|
|
if ($entity instanceof Host) {
|
|
|
|
+ $query = "SELECT COUNT(*) AS `exists`
|
|
|
|
+ FROM information_schema.tables
|
|
|
|
+ WHERE table_schema = 'kea'
|
|
|
|
+ AND table_name = 'hosts';";
|
|
|
|
+
|
|
|
|
+ $databaseConnection = $this->serviceContainer->get('database_connection');
|
|
|
|
+ $stmt = $databaseConnection->prepare($query);
|
|
|
|
+ $stmt->execute();
|
|
|
|
+ $tableExists = $stmt->fetchAll();
|
|
|
|
+ if (!isset($tableExists[0]['exists']) || $tableExists[0]['exists'] == '0') {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
if ($entity->getFixedAddress() && $remove == false) {
|
|
if ($entity->getFixedAddress() && $remove == false) {
|
|
$query = "
|
|
$query = "
|