propertyValue() public method

{@inheritDoc}
public propertyValue ( $selectorName, $propertyName )
Exemplo n.º 1
0
 public function testQueryWithOrderings()
 {
     $this->nodeTypeManager->expects($this->once())->method('getSubtypes')->will($this->returnValue(array()));
     $query = $this->factory->createQuery($this->factory->selector('nt:unstructured', 'nt:unstructured'), null, array($this->factory->ascending($this->factory->propertyValue('nt:unstructured', "jcr:path"))), array());
     list($selectors, $selectorAliases, $sql) = $this->walker->walkQOMQuery($query);
     $this->assertEquals(sprintf("SELECT %s FROM phpcr_nodes n0 WHERE n0.workspace_name = ? AND n0.type IN ('nt:unstructured') ORDER BY n0.path ASC", $this->defaultColumns), $sql);
 }
 public function testQueryWithOrderings()
 {
     $driver = $this->conn->getDriver()->getName();
     $this->nodeTypeManager->expects($this->once())->method('getSubtypes')->will($this->returnValue(array()));
     $query = $this->factory->createQuery($this->factory->selector('nt:unstructured', 'nt:unstructured'), null, array($this->factory->ascending($this->factory->propertyValue('nt:unstructured', "foobar"))), array());
     $res = $this->walker->walkQOMQuery($query);
     switch ($driver) {
         case 'pdo_pgsql':
             $ordering = "CAST((xpath('//sv:property[@sv:name=\"foobar\"]/sv:value[1]/text()', CAST(n0.numerical_props AS xml), ARRAY[ARRAY['sv', 'http://www.jcp.org/jcr/sv/1.0']]))[1]::text AS DECIMAL) ASC, " . "(xpath('//sv:property[@sv:name=\"foobar\"]/sv:value[1]/text()', CAST(n0.props AS xml), ARRAY[ARRAY['sv', 'http://www.jcp.org/jcr/sv/1.0']]))[1]::text ASC";
             break;
         default:
             $ordering = "CAST(EXTRACTVALUE(n0.numerical_props, '//sv:property[@sv:name=\"foobar\"]/sv:value[1]') AS DECIMAL) ASC, " . "EXTRACTVALUE(n0.props, '//sv:property[@sv:name=\"foobar\"]/sv:value[1]') ASC";
     }
     $this->assertEquals(sprintf(implode(' ', array("SELECT %s FROM phpcr_nodes n0 WHERE n0.workspace_name = ?", "AND n0.type IN ('nt:unstructured')", "ORDER BY", $ordering)), $this->defaultColumns), $res[2]);
 }