Returns venues that people often check in to after the current venue.
@param $venueId
@return array
439217
public function nextVenues($venueId)
    {

        $resource = '/venues/' . $venueId . '/nextvenues';
        $response = $this->makeApiRequest($resource);

        if(property_exists($response, 'nextVenues')) {
            return $response->nextVenues->items;
        }

        return array();

    }
1235594
public function getParent($parentId)
    {
        if ($parentId && isset($this->site->pages[$parentId])) {
            return $this->site->pages[$parentId];
        }

        return [];
    }
1193466
public function getRecurrenceEventId(?string $id = null): array
    {
        $result = [];

        if (empty($id)) {
            return $result;
        }

        if (preg_match('/(^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})(__(\d+)?_(\d+)?)?/', $id, $matches)) {
            $result['id'] = $matches[1];
            $result['start'] = !empty($matches[3]) ? date('Y-m-d H:i:s', $matches[3]) : null;
            $result['end'] = !empty($matches[4]) ? date('Y-m-d H:i:s', $matches[4]) : null;
        }

        return $result;
    }
481872
public function lists($venueId)
    {

        $resource = '/venues/' . $venueId . '/listed';
        $response = $this->makeApiRequest($resource);

        if(property_exists($response, 'lists')) {
            return $response->lists->groups;
        }

        return array();

    }
1054391
public function getActiveSiteTheme($siteId)
    {
        $qb = $this->getEntityManager()->createQueryBuilder();
        /** @var $query \Doctrine\ORM\Query */

        $query = $qb->select('e, t')
            ->from($this->_entity, 'e')
            ->innerJoin('e.themeId', 't')
            ->where('e.siteId = :id')
            ->andWhere('e.isActive = 1')
            ->setMaxResults(1)
            ->setParameter('id', $siteId)
            ->getQuery();

        /** @var $result \PageBuilder\Entity\Join\SiteTheme */
        $result = $query->getOneOrNullResult(AbstractQuery::HYDRATE_OBJECT);
        if ($result) {
            return $result->getThemeId();
        } else {
            return $result;
        }
    }
1258995
private function getPublishedEvents($eventId = null)
    {
        if (!$this->publishedEvents) {
            $campaignIds = array_keys($this->getPublishedCampaigns());
            if ($campaignIds) {
                foreach ($this->eventModel->getRepository()->getEntities(
                    [
                        'filter' => [
                            'force' => [
                                [
                                    'column' => 'IDENTITY(e.campaign)',
                                    'expr'   => 'in',
                                    'value'  => $campaignIds,
                                ],
                            ],
                        ],
                    ]
                ) as $event) {
                    $this->publishedEvents[$event->getId()] = $event->getName();
                }
            }
        }
        if ($eventId) {
            return isset($this->publishedEvents[$eventId]) ? $this->publishedEvents[$eventId] : null;
        } else {
            return $this->publishedEvents;
        }
    }
902881
private function getPlaceListLocation(int $id): array
    {
        // We know the id of the place in the placelocation table,
        // now get the id of the same place in the places table
        if ($id === 0) {
            $fqpn = '';
        } else {
            $hierarchy = $this->getHierarchy($id);
            $fqpn      = ', ' . $hierarchy[0]->fqpn;
        }

        $rows = DB::table('placelocation')
            ->where('pl_parent_id', '=', $id)
            ->orderBy('pl_place')
            ->get();

        $list = [];
        foreach ($rows as $row) {
            // Find/count places without co-ordinates
            $children = $this->childLocationStatus((int) $row->pl_id);
            $active   = $this->isLocationActive($row->pl_place . $fqpn);

            if (!$active) {
                $badge = 'danger';
            } elseif ((int) $children->no_coord > 0) {
                $badge = 'warning';
            } elseif ((int) $children->child_count > 0) {
                $badge = 'info';
            } else {
                $badge = 'secondary';
            }

            $row->child_count = (int) $children->child_count;
            $row->badge       = $badge;

            $list[] = $row;
        }

        return $list;
    }
799791
public function getSectionEvents($id)
    {
        return isset($this->sections[$id]) ? $this->sections[$id]->getEvents() : [];
    }
836331
public function getDataBySiteIdAndPageId($siteId, $pageId)
	{
	    $select = $this->tableGateway->getSql()->select();
	     
	    $select->columns(array('*'));
	     
	    $select->where(array("s404_site_id" => $siteId, 's404_page_id' => $pageId));
	    $resultSet = $this->tableGateway->selectWith($select);
	     
	    return $resultSet;
	}
516545
public function getOrganizations()
    {
        $sql = "SELECT gor_id_organization, gor_name
                    FROM gems__organizations
                    WHERE gor_active = 1
                    ORDER BY gor_name";

        try {
            $organizations = $this->_getSelectPairsCached(__FUNCTION__, $sql, null, 'organizations', 'natsort');
        } catch (\Exception $exc) {
            // Intentional fallthrough when no db present
            $organizations = array();
        }

        return $organizations;
    }
1227545
public function managed()
    {
        $resource = '/venues/managed';
        $response = $this->makeApiRequest($resource);

        if(property_exists($response, 'venues')) {
            return $response->venues;
        }
        
        return array();
    }
1329763
public function findLastIndexedRow(int $rootPageId) : array
    {
        $queryBuilder = $this->getQueryBuilder();
        $row = $queryBuilder
            ->select('uid', 'indexed')
            ->from($this->table)
            ->where($queryBuilder->expr()->eq('root', $rootPageId))
            ->andWhere($queryBuilder->expr()->neq('indexed', 0))
            ->orderBy('indexed', 'DESC')
            ->setMaxResults(1)
            ->execute()->fetchAll();

        return $row;
    }
1181932
protected function siteResourceMapper($resourceId)
    {
        if (!$this->resourceName->isSitesResourceId($resourceId)) {
            return null;
        }

        $sitesResourceId = $this->resourceName->get(self::RESOURCE_SITES);

        $return = [
            'resourceId' => $resourceId,
            'parentResourceId' => $sitesResourceId,
        ];

        return array_merge(
            $this->resources[self::RESOURCE_SITES],
            $return
        );
    }
631788
public function hereNow($venueId)
    {

        $resource = '/venues/' . $venueId . '/herenow';
        $response = $this->makeApiRequest($resource);

        if(property_exists($response, 'hereNow')) {
            return $response->hereNow->count;
        }

        return 0;

    }
560724
protected function getSitePagesResourceId($siteId)
    {
        /** @var ResourceName $resourceName */
        $resourceName = $this->getServiceLocator()->get(
            ResourceName::class
        );

        return $resourceName->get(
            ResourceName::RESOURCE_SITES,
            $siteId,
            ResourceName::RESOURCE_PAGES
        );
    }
275350
public function getRedirectEntityList($siteId)
    {
        try {
            $result = $this->getRedirectQuery($siteId)->getResult();
        } catch (NoResultException $e) {
            $result = [];
        }

        return $result;
    }
383120
public function getAllDeathPlaces(): array
    {
        foreach (Gedcom::DEATH_EVENTS as $event) {
            $places = $this->getAllEventPlaces([$event]);
            if (!empty($places)) {
                return $places;
            }
        }

        return [];
    }