Пример #1
0
 public function testGetSet()
 {
     $statement = new Statement();
     $persister = new TestPersister(new TestVisitor('test'));
     $query = new Query($statement);
     $this->assertEquals($statement, $query->getStatement());
     $this->assertNull($query->getPersister());
     $query->setPersister($persister);
     $this->assertEquals($persister, $query->getPersister());
 }
Пример #2
0
 /**
  * getNativeQuery 
  * 
  * @param Query $query 
  * @access public
  * @return void
  */
 public function getNativeQuery(Query $query, array $options = array())
 {
     // Clone the original SimpleExpression
     $statement = clone $query->getStatement();
     // Apply CustomVisitors to modify SimpleExpression
     $customVisitors = $this->getCustomVisitors();
     if ($customVisitors) {
         $statement->dispatch($customVisitors);
     }
     // Apply OuterVisitor to output the nativeQuery from SimpleExpression
     $outerVisitor = $this->getOuterVisitor();
     $statement->dispatch($outerVisitor);
     // Get NativeQuery from the Visitor
     return $outerVisitor->getNativeQuery($options);
 }