Router bugfix, save and update route frontend
This commit is contained in:
@@ -2,8 +2,18 @@
|
||||
|
||||
namespace Core\Objects\Router;
|
||||
|
||||
use Core\Driver\SQL\SQL;
|
||||
|
||||
class RedirectPermanentlyRoute extends RedirectRoute {
|
||||
|
||||
const HTTP_STATUS_CODE = 308;
|
||||
|
||||
public function __construct(string $pattern, bool $exact, string $destination) {
|
||||
parent::__construct("redirect_permanently", $pattern, $exact, $destination, 308);
|
||||
parent::__construct("redirect_permanently", $pattern, $exact, $destination, self::HTTP_STATUS_CODE);
|
||||
}
|
||||
|
||||
public function postFetch(SQL $sql, array $row) {
|
||||
parent::postFetch($sql, $row);
|
||||
$this->code = self::HTTP_STATUS_CODE;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ use JetBrains\PhpStorm\Pure;
|
||||
class RedirectRoute extends Route {
|
||||
|
||||
#[Transient]
|
||||
private int $code;
|
||||
protected int $code;
|
||||
|
||||
public function __construct(string $type, string $pattern, bool $exact, string $destination, int $code = 307) {
|
||||
parent::__construct($type, $pattern, $destination, $exact);
|
||||
|
||||
@@ -2,8 +2,18 @@
|
||||
|
||||
namespace Core\Objects\Router;
|
||||
|
||||
use Core\Driver\SQL\SQL;
|
||||
|
||||
class RedirectTemporaryRoute extends RedirectRoute {
|
||||
|
||||
const HTTP_STATUS_CODE = 307;
|
||||
|
||||
public function __construct(string $pattern, bool $exact, string $destination) {
|
||||
parent::__construct("redirect_temporary", $pattern, $exact, $destination, 307);
|
||||
parent::__construct("redirect_temporary", $pattern, $exact, $destination, self::HTTP_STATUS_CODE);
|
||||
}
|
||||
|
||||
public function postFetch(SQL $sql, array $row) {
|
||||
parent::postFetch($sql, $row);
|
||||
$this->code = self::HTTP_STATUS_CODE;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class StaticRoute extends Route {
|
||||
private int $code;
|
||||
|
||||
public function __construct(string $pattern, bool $exact, string $data, int $code = 200) {
|
||||
parent::__construct("static", $pattern, $exact);
|
||||
parent::__construct("static", $pattern, "", $exact);
|
||||
$this->data = $data;
|
||||
$this->code = $code;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user