예제 #1
0
파일: QueryTest.php 프로젝트: o3co/query
 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);
 }