/** * @param Query $query * @param bool $isForceExpandValues * @return Query */ public function transformQuery(Query $query, $isForceExpandValues = false) { $this->isForceExpandValues = $isForceExpandValues; $this->values = $query->getValues(); $this->preparedValues = []; $this->numberPlaceholder = 0; $this->isHookSkipValue = false; $transformQueryAsText = preg_replace_callback($this->getRegexpMain(), [$this, 'transformCallback'], $query->getQueryAsText()); return Query::create($transformQueryAsText, $this->preparedValues); }
public function testTransformQuery_CustomAdapterCustomPlaceholderWithCommonNativePlaceholderWithoutExpandValueFewValues() { $myAdapter = Helper::getMockCustomAdapter(); $placeholders = new PlaceholderCollection(); $placeholders->addPlaceholder(Helper::getMockCustomPlaceholder('?m')); $transformer = new QueryTransformer($myAdapter, $placeholders); $result = $transformer->transformQuery(Query::create('SQL_TEXT ?m, ?m SQL_TEXT', ['in1']), false); $this->assertEquals('SQL_TEXT ?, ERROR_NO_VALUE SQL_TEXT', $result->getQueryAsText()); $this->assertSame(['out1'], $result->getValues()); }