Polymorphic refactor + improvements to select sql rewriting

This commit is contained in:
Matthew Bucci
2023-10-28 02:56:41 -07:00
parent a45338251e
commit 83002198b1
11 changed files with 1384 additions and 624 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
abstract class AbstractSQLRewriter
{
protected string $originalSQL;
public function __construct(string $sql)
{
$this->originalSQL = $sql;
}
abstract public function rewrite(): string;
public function original(): string
{
return $this->originalSQL;
}
public function type(): string
{
// Get the called class name and remove the "SQLRewriter" suffix to get the SQL type
$className = get_called_class();
$type = str_replace('SQLRewriter', '', $className);
return $type;
}
}