classes/controllers/WbneighborWebController.php
private function getNeighbor(Date $slugDate, $direction = 'next')
    {
        if (strcasecmp($direction, 'next') == 0) {
            $activeDate = 'ActiveDate.after';
            $orderBy = 'ActiveDate ASC';
            $slugDate = $slugDate->modify('+1 minute');
        } else {
            $activeDate = 'ActiveDate.before';
            $orderBy = 'ActiveDate DESC';
            $slugDate = $slugDate->modify('-1 minute');
        }

        $nq = new NodeQuery();
        $this->passthruTemplateVariable($nq, 'Elements.in');
        $this->passthruTemplateVariable($nq, 'OutTags.exist');
        $this->passthruTemplateVariable($nq, 'Meta.select');
        $this->passthruTemplateVariable($nq, 'OutTags.select');
        $this->passthruTemplateVariable($nq, 'InTags.select');
        $this->setMetaWhereParams($nq);
        $nq->setParameter($activeDate, $slugDate);
        $nq->setParameter('Status.isActive', true);
        $nq->setLimit(1);
        $nq->isRetrieveTotalRecords(false);
        $nq->setOrderBy($orderBy);

        return $this->RegulatedNodeService->findAll($nq)->getResults();
    }
private function getNeighbor(Date $slugDate, $direction = 'next')
    {
        if (strcasecmp($direction, 'next') == 0) {
            $activeDate = 'ActiveDate.after';
            $orderBy = 'ActiveDate ASC';
            $slugDate = $slugDate->modify('+1 minute');
        } else {
            $activeDate = 'ActiveDate.before';
            $orderBy = 'ActiveDate DESC';
            $slugDate = $slugDate->modify('-1 minute');
        }

        $nq = new NodeQuery();
        $this->passthruTemplateVariable($nq, 'Elements.in');
        $this->passthruTemplateVariable($nq, 'OutTags.exist');
        $this->passthruTemplateVariable($nq, 'Meta.select');
        $this->passthruTemplateVariable($nq, 'OutTags.select');
        $this->passthruTemplateVariable($nq, 'InTags.select');
        $this->setMetaWhereParams($nq);
        $nq->setParameter($activeDate, $slugDate);
        $nq->setParameter('Status.isActive', true);
        $nq->setLimit(1);
        $nq->isRetrieveTotalRecords(false);
        $nq->setOrderBy($orderBy);

        return $this->RegulatedNodeService->findAll($nq)->getResults();
    }
private function getNeighbor ( Date $ slugDate , $ direction = 'next' ) { if ( strcasecmp ( $ direction , 'next' ) == 0 ) { $ activeDate = 'ActiveDate.after' ; $ orderBy = 'ActiveDate ASC' ; $ slugDate = $ slugDate -> modify ( '+1 minute' ) ; } else { $ activeDate = 'ActiveDate.before' ; $ orderBy = 'ActiveDate DESC' ; $ slugDate = $ slugDate -> modify ( '-1 minute' ) ; } $ nq = new NodeQuery ( ) ; $ this -> passthruTemplateVariable ( $ nq , 'Elements.in' ) ; $ this -> passthruTemplateVariable ( $ nq , 'OutTags.exist' ) ; $ this -> passthruTemplateVariable ( $ nq , 'Meta.select' ) ; $ this -> passthruTemplateVariable ( $ nq , 'OutTags.select' ) ; $ this -> passthruTemplateVariable ( $ nq , 'InTags.select' ) ; $ this -> setMetaWhereParams ( $ nq ) ; $ nq -> setParameter ( $ activeDate , $ slugDate ) ; $ nq -> setParameter ( 'Status.isActive' , true ) ; $ nq -> setLimit ( 1 ) ; $ nq -> isRetrieveTotalRecords ( false ) ; $ nq -> setOrderBy ( $ orderBy ) ; return $ this -> RegulatedNodeService -> findAll ( $ nq ) -> getResults ( ) ; }
gets a single neighboring item

@param Date $slugDate
@param string $direction
@return mixed
gets a single neighboring item