mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 15:06:06 +00:00
dev
This commit is contained in:
@@ -34,7 +34,7 @@ interface Request
|
||||
/**
|
||||
* Get a query parameter.
|
||||
*/
|
||||
public function get(string $name) : ?string;
|
||||
public function get(string $name);
|
||||
|
||||
/**
|
||||
* Get a header value.
|
||||
|
||||
@@ -44,9 +44,12 @@ class RequestWrapper implements ApiRequest
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function get(string $name) : ?string
|
||||
public function get(string $name)
|
||||
{
|
||||
return $this->request->getQueryParams()[$name] ?? null;
|
||||
$params = $this->request->getQueryParams();
|
||||
$value = $params[$name] ?? null;
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getHeader(string $name) : ?string
|
||||
|
||||
@@ -139,7 +139,9 @@ class Application
|
||||
}
|
||||
|
||||
$slim->add(
|
||||
function (Request $request, RequestHandler $handler) use ($entryPointManager, $entryPoint, $data) {
|
||||
function (Request $request, RequestHandler $handler) use (
|
||||
$entryPointManager, $entryPoint, $data, $authRequired, $authNotStrict
|
||||
) {
|
||||
$response = $handler->handle($request);
|
||||
|
||||
$output = new ApiOutput($request);
|
||||
@@ -161,7 +163,7 @@ class Application
|
||||
$responseWrapped = new ResponseWrapper($response);
|
||||
|
||||
ob_start();
|
||||
$entryPointManager->run($entryPoint, $requestWrapped, $data, $responseWrapped);
|
||||
$entryPointManager->run($entryPoint, $requestWrapped, $responseWrapped, $data);
|
||||
$contents = ob_get_clean();
|
||||
|
||||
$response = $responseWrapped->getResponse();
|
||||
@@ -178,7 +180,11 @@ class Application
|
||||
}
|
||||
);
|
||||
|
||||
$this->slim->run();
|
||||
$slim->get('/', function (Request $request, Response $response) {
|
||||
return $response;
|
||||
});
|
||||
|
||||
$slim->run();
|
||||
|
||||
/*try {
|
||||
|
||||
|
||||
@@ -34,10 +34,10 @@ use Espo\Core\Exceptions\NotFound;
|
||||
use Espo\Core\{
|
||||
InjectableFactory,
|
||||
Utils\ClassFinder,
|
||||
Api\Request,
|
||||
Api\Response,
|
||||
};
|
||||
|
||||
use Slim\Http\Request;
|
||||
|
||||
class EntryPointManager
|
||||
{
|
||||
protected $injectableFactory;
|
||||
@@ -74,7 +74,7 @@ class EntryPointManager
|
||||
return $className::$notStrictAuth ?? false;
|
||||
}
|
||||
|
||||
public function run(string $name, Request $request, array $data = [])
|
||||
public function run(string $name, Request $request, Response $response, array $data = [])
|
||||
{
|
||||
$className = $this->getClassName($name);
|
||||
if (!$className) {
|
||||
@@ -83,7 +83,7 @@ class EntryPointManager
|
||||
|
||||
$entryPoint = $this->injectableFactory->create($className);
|
||||
|
||||
$entryPoint->run($request, $data);
|
||||
$entryPoint->run($request, $response, $data);
|
||||
}
|
||||
|
||||
protected function getClassName(string $name) : ?string
|
||||
|
||||
@@ -55,7 +55,7 @@ class Portal implements EntryPoint
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function run($request, $data = [])
|
||||
public function run($request, $response, $data = [])
|
||||
{
|
||||
$id = $request->get('id') ?? $data['id'] ?? null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user