Jackalope\Query\QOM\QueryObjectModelFactory::comparison PHP Method

comparison() public method

{@inheritDoc}
public comparison ( PHPCR\Query\QOM\DynamicOperandInterface $operand1, $operator, PHPCR\Query\QOM\StaticOperandInterface $operand2 )
$operand1 PHPCR\Query\QOM\DynamicOperandInterface
$operand2 PHPCR\Query\QOM\StaticOperandInterface
    public function comparison(DynamicOperandInterface $operand1, $operator, StaticOperandInterface $operand2)
    {
        return new ComparisonConstraint($operand1, $operator, $operand2);
    }

Usage Example

 /**
  * @dataProvider dataQueryWithOperator
  * @param type $const
  * @param type $op
  */
 public function testQueryWithOperator($const, $op)
 {
     $this->nodeTypeManager->expects($this->once())->method('getSubtypes')->will($this->returnValue(array()));
     $query = $this->factory->createQuery($this->factory->selector('nt:unstructured', 'nt:unstructured'), $this->factory->comparison($this->factory->propertyValue('nt:unstructured', 'jcr:path'), $const, $this->factory->literal('/')), array(), 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') AND n0.path {$op} '/'", $this->defaultColumns), $sql);
 }