bugfix
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Core\API {
|
||||
|
||||
public function __construct(Context $context, bool $externalCall, array $params) {
|
||||
parent::__construct($context, $externalCall, $params);
|
||||
$this->routerCachePath = getClassPath(self::ROUTER_CACHE_CLASS);
|
||||
$this->routerCachePath = WEBROOT . DIRECTORY_SEPARATOR . getClassPath(self::ROUTER_CACHE_CLASS);
|
||||
}
|
||||
|
||||
protected function toggleRoute(int $id, bool $active): bool {
|
||||
|
||||
@@ -419,9 +419,11 @@ class MySQL extends SQL {
|
||||
$returns = $procedure->getReturns();
|
||||
$paramDefs = [];
|
||||
|
||||
foreach ($procedure->getParameters() as $param) {
|
||||
if ($param instanceof Column) {
|
||||
$paramDefs[] = $this->getParameterDefinition($param);
|
||||
foreach ($procedure->getParameters() as $parameter) {
|
||||
if ($parameter instanceof Column) {
|
||||
$paramDefs[] = $this->getParameterDefinition($parameter);
|
||||
} else if ($parameter instanceof CurrentTable) {
|
||||
$paramDefs[] = $this->getParameterDefinition($parameter->toColumn());
|
||||
} else {
|
||||
$this->lastError = $this->logger->error("PROCEDURE parameter type " . gettype($returns) . " is not implemented yet");
|
||||
return null;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
namespace Core\Driver\SQL\Query;
|
||||
|
||||
use Core\Driver\SQL\Column\Column;
|
||||
use Core\Driver\SQL\Expression\Expression;
|
||||
use Core\Driver\SQL\SQL;
|
||||
|
||||
class CreateProcedure extends Query {
|
||||
@@ -21,7 +22,7 @@ class CreateProcedure extends Query {
|
||||
$this->returns = NULL;
|
||||
}
|
||||
|
||||
public function param(Column $parameter): CreateProcedure {
|
||||
public function param(Expression $parameter): CreateProcedure {
|
||||
$this->parameters[] = $parameter;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace Core\Driver\SQL\Type;
|
||||
|
||||
use Core\Driver\SQL\Column\Column;
|
||||
use Core\Driver\SQL\Column\StringColumn;
|
||||
use Core\Driver\SQL\Expression\Expression;
|
||||
use Core\Driver\SQL\MySQL;
|
||||
use Core\Driver\SQL\PostgreSQL;
|
||||
use Core\Driver\SQL\SQL;
|
||||
use Exception;
|
||||
|
||||
class CurrentTable extends Expression {
|
||||
|
||||
@@ -14,11 +17,15 @@ class CurrentTable extends Expression {
|
||||
|
||||
function getExpression(SQL $sql, array &$params): string {
|
||||
if ($sql instanceof MySQL) {
|
||||
// CURRENT_TABLE
|
||||
return $sql->columnName("CURRENT_TABLE");
|
||||
} else if ($sql instanceof PostgreSQL) {
|
||||
return "TG_TABLE_NAME";
|
||||
} else {
|
||||
|
||||
throw new Exception("CurrentTable Not implemented for driver type: " . get_class($sql));
|
||||
}
|
||||
}
|
||||
|
||||
public function toColumn(): Column {
|
||||
return new StringColumn("CURRENT_TABLE");
|
||||
}
|
||||
}
|
||||
@@ -461,7 +461,7 @@ class DatabaseEntityHandler implements Persistable {
|
||||
|
||||
$doInsert = false;
|
||||
foreach ($nmRelation->getProperties($this) as $property) {
|
||||
if ($properties !== null || !in_array($property->getName(), $properties)) {
|
||||
if ($properties !== null && !in_array($property->getName(), $properties)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,6 +124,14 @@ class RouterCache extends Router {
|
||||
}
|
||||
";
|
||||
|
||||
$directory = dirname($file);
|
||||
if (!is_dir($directory)) {
|
||||
if (!mkdir($directory, 775, true)) {
|
||||
$this->logger->severe("Could not create directory: $directory");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (@file_put_contents($file, $code) === false) {
|
||||
$this->logger->severe("Could not write Router cache file: $file");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user