/** * @param Query $query * @return string */ private function translate(Query $query) { $translated = $this->connection->translate($query->_export()); /** @var Entity $entityClass */ $entityClass = $this->mapper->getEntityClass($this->getTable()); $reflection = $entityClass::getReflection($this->mapper); foreach ($reflection->getEntityProperties() as $property) { $name = $property->getName(); $column = $property->getColumn(); $translated = preg_replace("/`{$name}`/", "`{$column}`", $translated); } return $translated; }