protected function single()
    {

        // check permissions
        // $this->checkSinglePermission();

        $nq = new NodeQuery();
        $nq->setLimit(1);
//        $this->buildFilters($nq);

        $this->passthruTemplateVariable($nq, 'Elements.in');
        $this->passthruTemplateVariable($nq, 'Sites.in');
        //$this->passthruTemplateVariable($nq, 'SiteIDs.in');

        $this->passthruTemplateVariable($nq, 'Meta.select');
        $this->passthruTemplateVariable($nq, 'OutTags.select');
        $this->passthruTemplateVariable($nq, 'InTags.select');
//        $this->passthruTemplateVariable($nq, 'Sections.select');

//        $this->passthruTemplateVariable($nq, 'Title.like');
//        $this->passthruTemplateVariable($nq, 'Title.ieq');
//        $this->passthruTemplateVariable($nq, 'Title.eq');
//        $this->passthruTemplateVariable($nq, 'Title.firstChar');
//        $this->passthruTemplateVariable($nq, 'Status.isActive');
//        $this->passthruTemplateVariable($nq, 'Status.all');
//        $this->passthruTemplateVariable($nq, 'Status.eq');
//        $this->passthruTemplateVariable($nq, 'TreeID.childOf');
//        $this->passthruTemplateVariable($nq, 'TreeID.eq');
//
//        $this->passthruTemplateVariable($nq, 'ActiveDate.before');
//        $this->passthruTemplateVariable($nq, 'ActiveDate.after');
//        $this->passthruTemplateVariable($nq, 'ActiveDate.start');
//        $this->passthruTemplateVariable($nq, 'ActiveDate.end');
//
//        $this->passthruTemplateVariable($nq, 'CreationDate.before');
//        $this->passthruTemplateVariable($nq, 'CreationDate.after');
//        $this->passthruTemplateVariable($nq, 'CreationDate.start');
//        $this->passthruTemplateVariable($nq, 'CreationDate.end');

//        $this->passthruTemplateVariable($nq, 'OutTags.exist');
//        $this->passthruTemplateVariable($nq, 'InTags.exist');
//        $this->passthruTemplateVariable($nq, 'Meta.exist');

//        foreach ($this->templateVars as $name => $value) {
//            if (strpos($name, '#') === 0)
//                $nq->setParameter($name, $value);
//        }

        $slug = $this->getTemplateVariable('Slugs.in');
        if ($slug != null) {
            $nq->setParameter('Slugs.in', $slug);

            $nq = $this->NodeRefService->normalizeNodeQuery($nq);

            $nodeRefs = $nq->getParameter('NodeRefs.normalized');
            $nodePartials = $nq->getParameter('NodePartials.eq');
            $allFullyQualified = $nq->getParameter('NodeRefs.fullyQualified');

            if(!$allFullyQualified || count($nodeRefs) > 1)
                throw new Exception('No Slugs.in set for DataSource');

            $row = $this->RegulatedNodeService->getByNodeRef(current($nodeRefs), $nodePartials);

            if(!empty($row))
                $nq->setResults(array($row));

            return $this->readNodeQuery($nq);
        }

        throw new Exception('No Slugs.in set for DataSource');
    }
protected function single()
    {

        // check permissions
        // $this->checkSinglePermission();

        $nq = new NodeQuery();
        $nq->setLimit(1);
//        $this->buildFilters($nq);

        $this->passthruTemplateVariable($nq, 'Elements.in');
        $this->passthruTemplateVariable($nq, 'Sites.in');
        //$this->passthruTemplateVariable($nq, 'SiteIDs.in');

        $this->passthruTemplateVariable($nq, 'Meta.select');
        $this->passthruTemplateVariable($nq, 'OutTags.select');
        $this->passthruTemplateVariable($nq, 'InTags.select');
//        $this->passthruTemplateVariable($nq, 'Sections.select');

//        $this->passthruTemplateVariable($nq, 'Title.like');
//        $this->passthruTemplateVariable($nq, 'Title.ieq');
//        $this->passthruTemplateVariable($nq, 'Title.eq');
//        $this->passthruTemplateVariable($nq, 'Title.firstChar');
//        $this->passthruTemplateVariable($nq, 'Status.isActive');
//        $this->passthruTemplateVariable($nq, 'Status.all');
//        $this->passthruTemplateVariable($nq, 'Status.eq');
//        $this->passthruTemplateVariable($nq, 'TreeID.childOf');
//        $this->passthruTemplateVariable($nq, 'TreeID.eq');
//
//        $this->passthruTemplateVariable($nq, 'ActiveDate.before');
//        $this->passthruTemplateVariable($nq, 'ActiveDate.after');
//        $this->passthruTemplateVariable($nq, 'ActiveDate.start');
//        $this->passthruTemplateVariable($nq, 'ActiveDate.end');
//
//        $this->passthruTemplateVariable($nq, 'CreationDate.before');
//        $this->passthruTemplateVariable($nq, 'CreationDate.after');
//        $this->passthruTemplateVariable($nq, 'CreationDate.start');
//        $this->passthruTemplateVariable($nq, 'CreationDate.end');

//        $this->passthruTemplateVariable($nq, 'OutTags.exist');
//        $this->passthruTemplateVariable($nq, 'InTags.exist');
//        $this->passthruTemplateVariable($nq, 'Meta.exist');

//        foreach ($this->templateVars as $name => $value) {
//            if (strpos($name, '#') === 0)
//                $nq->setParameter($name, $value);
//        }

        $slug = $this->getTemplateVariable('Slugs.in');
        if ($slug != null) {
            $nq->setParameter('Slugs.in', $slug);

            $nq = $this->NodeRefService->normalizeNodeQuery($nq);

            $nodeRefs = $nq->getParameter('NodeRefs.normalized');
            $nodePartials = $nq->getParameter('NodePartials.eq');
            $allFullyQualified = $nq->getParameter('NodeRefs.fullyQualified');

            if(!$allFullyQualified || count($nodeRefs) > 1)
                throw new Exception('No Slugs.in set for DataSource');

            $row = $this->RegulatedNodeService->getByNodeRef(current($nodeRefs), $nodePartials);

            if(!empty($row))
                $nq->setResults(array($row));

            return $this->readNodeQuery($nq);
        }

        throw new Exception('No Slugs.in set for DataSource');
    }
protected function single ( ) { // check permissions // $this->checkSinglePermission(); $ nq = new NodeQuery ( ) ; $ nq -> setLimit ( 1 ) ; //        $this->buildFilters($nq); $ this -> passthruTemplateVariable ( $ nq , 'Elements.in' ) ; $ this -> passthruTemplateVariable ( $ nq , 'Sites.in' ) ; //$this->passthruTemplateVariable($nq, 'SiteIDs.in'); $ this -> passthruTemplateVariable ( $ nq , 'Meta.select' ) ; $ this -> passthruTemplateVariable ( $ nq , 'OutTags.select' ) ; $ this -> passthruTemplateVariable ( $ nq , 'InTags.select' ) ; //        $this->passthruTemplateVariable($nq, 'Sections.select'); //        $this->passthruTemplateVariable($nq, 'Title.like'); //        $this->passthruTemplateVariable($nq, 'Title.ieq'); //        $this->passthruTemplateVariable($nq, 'Title.eq'); //        $this->passthruTemplateVariable($nq, 'Title.firstChar'); //        $this->passthruTemplateVariable($nq, 'Status.isActive'); //        $this->passthruTemplateVariable($nq, 'Status.all'); //        $this->passthruTemplateVariable($nq, 'Status.eq'); //        $this->passthruTemplateVariable($nq, 'TreeID.childOf'); //        $this->passthruTemplateVariable($nq, 'TreeID.eq'); // //        $this->passthruTemplateVariable($nq, 'ActiveDate.before'); //        $this->passthruTemplateVariable($nq, 'ActiveDate.after'); //        $this->passthruTemplateVariable($nq, 'ActiveDate.start'); //        $this->passthruTemplateVariable($nq, 'ActiveDate.end'); // //        $this->passthruTemplateVariable($nq, 'CreationDate.before'); //        $this->passthruTemplateVariable($nq, 'CreationDate.after'); //        $this->passthruTemplateVariable($nq, 'CreationDate.start'); //        $this->passthruTemplateVariable($nq, 'CreationDate.end'); //        $this->passthruTemplateVariable($nq, 'OutTags.exist'); //        $this->passthruTemplateVariable($nq, 'InTags.exist'); //        $this->passthruTemplateVariable($nq, 'Meta.exist'); //        foreach ($this->templateVars as $name => $value) { //            if (strpos($name, '#') === 0) //                $nq->setParameter($name, $value); //        } $ slug = $ this -> getTemplateVariable ( 'Slugs.in' ) ; if ( $ slug != null ) { $ nq -> setParameter ( 'Slugs.in' , $ slug ) ; $ nq = $ this -> NodeRefService -> normalizeNodeQuery ( $ nq ) ; $ nodeRefs = $ nq -> getParameter ( 'NodeRefs.normalized' ) ; $ nodePartials = $ nq -> getParameter ( 'NodePartials.eq' ) ; $ allFullyQualified = $ nq -> getParameter ( 'NodeRefs.fullyQualified' ) ; if ( ! $ allFullyQualified || count ( $ nodeRefs ) > 1 ) throw new Exception ( 'No Slugs.in set for DataSource' ) ; $ row = $ this -> RegulatedNodeService -> getByNodeRef ( current ( $ nodeRefs ) , $ nodePartials ) ; if ( ! empty ( $ row ) ) $ nq -> setResults ( array ( $ row ) ) ; return $ this -> readNodeQuery ( $ nq ) ; } throw new Exception ( 'No Slugs.in set for DataSource' ) ; }
Datasource for returning a single Node

@return DTO Contains the matching node (as an array) or is empty
Datasource for returning a single Node