$area = null;
if ($thisconfig->hasValue('AreaID')) {
    $repo = new repositories\AreaRepository();
    $area = $repo->loadById($thisconfig->get('AreaID'));
    if ($area) {
        $calendar->getEventRepositoryBuilder()->setArea($area);
    } else {
        die("Area not loaded!\n");
    }
}
// ######################################################### Get Data
$calendar->getEventRepositoryBuilder()->setIncludeAreaInformation(true);
$calData = $calendar->getData();
$childAreas = array();
if ($thisconfig->getBoolean('ListChildAreas', false)) {
    $areaRepoBuilder = new \repositories\builders\AreaRepositoryBuilder();
    $areaRepoBuilder->setSite($site);
    $areaRepoBuilder->setIncludeDeleted(false);
    if ($area) {
        $areaRepoBuilder->setParentArea($area);
    } else {
        $areaRepoBuilder->setNoParentArea(true);
    }
    $childAreas = array();
    $areaRepository = new AreaRepository();
    foreach ($areaRepoBuilder->fetchAll() as $area) {
        $areaRepository->updateFutureEventsCache($area);
        if ($thisconfig->getBoolean('ListChildAreasWithNoEvents', false) || $area->getCachedFutureEvents() > 0) {
            $childAreas[] = $area;
        }
    }
<?php

define('APP_ROOT_DIR', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
require_once (defined('COMPOSER_ROOT_DIR') ? COMPOSER_ROOT_DIR : APP_ROOT_DIR) . '/vendor/autoload.php';
require_once APP_ROOT_DIR . '/core/php/autoload.php';
require_once APP_ROOT_DIR . '/core/php/autoloadCLI.php';
/**
 *
 * @package com.meetyournextmp
 * @license Closed Source
 * @copyright (c) 2013-2015, JMB Technology Limited, http://jmbtechnology.co.uk/
 * @author James Baster <*****@*****.**>
 */
// AREAS
$parentAreas = array('England' => null, 'Scotland' => null, 'Wales' => null, 'Northern Ireland' => null);
$arb = new \repositories\builders\AreaRepositoryBuilder();
$arb->setNoParentArea(true);
$arb->setIncludeDeleted(false);
$arb->fetchAll();
foreach ($arb->fetchAll() as $area) {
    foreach ($parentAreas as $key => $value) {
        if ($area->getTitle() == $key) {
            $parentAreas[$key] = $area;
        }
    }
}
foreach ($parentAreas as $key => $value) {
    if (!$value) {
        die("No area for " . $key);
    }
}