/** * @test */ public function propertyNameFilterIsSupported() { $q = new FlowQuery(array($this->node, $this->node->getNode('products'))); $foundNodes = $q->filter('home')->get(); $this->assertSame($this->node, $foundNodes[0]); $this->assertEquals(1, count($foundNodes)); $foundNodes = $q->children('x')->get(); $this->assertEquals(0, count($foundNodes)); }
/** * Render the form. * * @return string * @api */ public function render() { $orderby = 'newsStartDate'; if (isset($_GET['orderby'])) { $orderby = $_GET['orderby']; } $flowQuery = new FlowQuery(array($this->arguments['node'])); $query = $flowQuery->children()->children('[instanceof PHLU.NewsAdmin:NewsStructureElement]')->get(); $newsItemsResult = array(); foreach ($query as $newsItemNode) { $newsItemsResult[] = array('key' => $newsItemNode->getProperty($orderby), 'node' => $newsItemNode); } $newsItemsResultSorted = $this->sort_arr_of_array($newsItemsResult, 'key', 'asc'); if ($this->templateVariableContainer->exists($this->arguments['as'])) { $this->templateVariableContainer->remove($this->arguments['as']); } $this->templateVariableContainer->add($this->arguments['as'], $newsItemsResultSorted); return $this->renderChildren(); }
/** * @test */ public function multipleCombinedFiltersIsSupported() { $q = new FlowQuery(array($this->node)); $foundNodes = $q->children('products[instanceof TYPO3.TYPO3CR.Testing:Page][title *= "Products"], about-us[instanceof TYPO3.TYPO3CR.Testing:Page][title *= "About Us"]')->get(); $this->assertEquals(2, count($foundNodes)); $foundNodes = $q->children('x[instanceof TYPO3.TYPO3CR.Testing:Page][title *= "Products"], about-us[instanceof TYPO3.TYPO3CR.Testing:Page][title *= "About Us"]')->get(); $this->assertEquals(1, count($foundNodes)); $foundNodes = $q->children('products[instanceof TYPO3.TYPO3CR.Testing:X][title *= "Products"], about-us[instanceof TYPO3.TYPO3CR.Testing:Page][title *= "About Us"]')->get(); $this->assertEquals(1, count($foundNodes)); $foundNodes = $q->children('x[instanceof TYPO3.TYPO3CR.Testing:Page][title *= "X"], about-us[instanceof TYPO3.TYPO3CR.Testing:Page][title *= "About Us"]')->get(); $this->assertEquals(1, count($foundNodes)); $foundNodes = $q->children('products[instanceof TYPO3.TYPO3CR.Testing:Page][title *= "Products"], x[instanceof TYPO3.TYPO3CR.Testing:Page][title *= "About Us"]')->get(); $this->assertEquals(1, count($foundNodes)); $foundNodes = $q->children('products[instanceof TYPO3.TYPO3CR.Testing:Page][title *= "Products"], about-us[instanceof TYPO3.TYPO3CR.Testing:X][title *= "About Us"]')->get(); $this->assertEquals(1, count($foundNodes)); $foundNodes = $q->children('products[instanceof TYPO3.TYPO3CR.Testing:Page][title *= "Products"], about-us[instanceof TYPO3.TYPO3CR.Testing:Page][title *= "X"]')->get(); $this->assertEquals(1, count($foundNodes)); }