protected function replaceTable($sql) {
		$table = $this->getTable();
		$i18nTable = $this->getTranslationTable();
		preg_match_all('/(?<![\.a-zA-Z0-9-_`\(\)])([a-z_][a-zA-Z0-9-_]*)(?![\.`\(\)])/', $sql, $matches);
		foreach($matches[0] as $property) {
			if($this->definition->hasProperty($property))
				$table = $this->definition->property($property)->get('i18n') ? $i18nTable:$table;
			$sql = preg_replace('/(?<![\.a-zA-Z0-9-_`\(\)])('.$property.')(?![\.a-zA-Z0-9-_`\(\)])/', $table.'.$1', $sql);
		}

		return $sql;
	}
protected function replaceTable($sql) {
		$table = $this->getTable();
		$i18nTable = $this->getTranslationTable();
		preg_match_all('/(?<![\.a-zA-Z0-9-_`\(\)])([a-z_][a-zA-Z0-9-_]*)(?![\.`\(\)])/', $sql, $matches);
		foreach($matches[0] as $property) {
			if($this->definition->hasProperty($property))
				$table = $this->definition->property($property)->get('i18n') ? $i18nTable:$table;
			$sql = preg_replace('/(?<![\.a-zA-Z0-9-_`\(\)])('.$property.')(?![\.a-zA-Z0-9-_`\(\)])/', $table.'.$1', $sql);
		}

		return $sql;
	}
protected function replaceTable ( $ sql ) { $ table = $ this -> getTable ( ) ; $ i18nTable = $ this -> getTranslationTable ( ) ; preg_match_all ( '/(?<![\.a-zA-Z0-9-_`\(\)])([a-z_][a-zA-Z0-9-_]*)(?![\.`\(\)])/' , $ sql , $ matches ) ; foreach ( $ matches [ 0 ] as $ property ) { if ( $ this -> definition -> hasProperty ( $ property ) ) $ table = $ this -> definition -> property ( $ property ) -> get ( 'i18n' ) ? $ i18nTable : $ table ; $ sql = preg_replace ( '/(?<![\.a-zA-Z0-9-_`\(\)])(' . $ property . ')(?![\.a-zA-Z0-9-_`\(\)])/' , $ table . '.$1' , $ sql ) ; } return $ sql ; }
Set the tables.

@param string $sql SQL query.

@return string The modified SQL query.
Set the tables .