} else {$this->log('TenantSettings not found or show_admin_documents not set for tenant ' . $tenant->id, 'debug');if ($tenantSettings) {
App\Controller\DocumentsController->index() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Controller/Controller.php, line 560 Cake\Controller\Controller->invokeAction() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Controller/ControllerFactory.php, line 140 Cake\Controller\ControllerFactory->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Controller/ControllerFactory.php, line 115 Cake\Controller\ControllerFactory->invoke() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/BaseApplication.php, line 325 Cake\Http\BaseApplication->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 86 Cake\Http\Runner->handle() /home/acqprojectsdev/public_html/src/Middleware/TenantMiddleware.php, line 327 App\Middleware\TenantMiddleware->process() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Middleware/BodyParserMiddleware.php, line 157 Cake\Http\Middleware\BodyParserMiddleware->process() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php, line 189 Cake\Routing\Middleware\RoutingMiddleware->process() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php, line 68 Cake\Routing\Middleware\AssetMiddleware->process() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php, line 149 Cake\Error\Middleware\ErrorHandlerMiddleware->process() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 67 Cake\Http\Runner->run() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Server.php, line 99 Cake\Http\Server->run() /home/acqprojectsdev/public_html/webroot/index.php, line 40 [main]
['Documents.tenant_id' => 4], // ID 4 pour admin global['Documents.tenant_id' => $tenant->id]];
App\Controller\DocumentsController->index() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Controller/Controller.php, line 560 Cake\Controller\Controller->invokeAction() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Controller/ControllerFactory.php, line 140 Cake\Controller\ControllerFactory->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Controller/ControllerFactory.php, line 115 Cake\Controller\ControllerFactory->invoke() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/BaseApplication.php, line 325 Cake\Http\BaseApplication->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 86 Cake\Http\Runner->handle() /home/acqprojectsdev/public_html/src/Middleware/TenantMiddleware.php, line 327 App\Middleware\TenantMiddleware->process() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Middleware/BodyParserMiddleware.php, line 157 Cake\Http\Middleware\BodyParserMiddleware->process() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php, line 189 Cake\Routing\Middleware\RoutingMiddleware->process() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php, line 68 Cake\Routing\Middleware\AssetMiddleware->process() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php, line 149 Cake\Error\Middleware\ErrorHandlerMiddleware->process() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Runner.php, line 67 Cake\Http\Runner->run() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Server.php, line 99 Cake\Http\Server->run() /home/acqprojectsdev/public_html/webroot/index.php, line 40 [main]
$message = "Unable to emit headers. Headers sent in file=$file line=$line";trigger_error($message, E_USER_WARNING);}
/home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 71 Cake\Http\ResponseEmitter->emit() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Server.php, line 137 Cake\Http\Server->emit() /home/acqprojectsdev/public_html/webroot/index.php, line 40 [main]
$reasonPhrase = $response->getReasonPhrase();header(sprintf('HTTP/%s %d%s',
/home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 164 Cake\Http\ResponseEmitter->emitStatusLine() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 74 Cake\Http\ResponseEmitter->emit() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Server.php, line 137 Cake\Http\Server->emit() /home/acqprojectsdev/public_html/webroot/index.php, line 40 [main]
foreach ($values as $value) {header(sprintf('%s: %s',
/home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 197 Cake\Http\ResponseEmitter->emitHeaders() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 75 Cake\Http\ResponseEmitter->emit() /home/acqprojectsdev/public_html/vendor/cakephp/cakephp/src/Http/Server.php, line 137 Cake\Http\Server->emit() /home/acqprojectsdev/public_html/webroot/index.php, line 40 [main]
Documents.tenant_id is missing operator (IS, IS NOT) with null value.
📋
$operator = '!='; |
|
} |
|
|
|
if ($value === null && $this->_conjunction !== ',') { |
|
throw new InvalidArgumentException( |
|
sprintf('Expression `%s` is missing operator (IS, IS NOT) with `null` value.', $expression) |
|
); |
|
} |
|
|
continue; |
|
} |
|
|
|
if (!$numericKey) { |
|
$this->_conditions[] = $this->_parseCondition($k, $c); |
|
} |
|
} |
|
} |
|
|
|
|
return $this; |
|
} |
|
|
|
$this->_addConditions($conditions, $types); |
|
|
|
return $this; |
|
} |
|
|
{ |
|
$this->setTypeMap($types); |
|
$this->setConjunction(strtoupper($conjunction)); |
|
if (!empty($conditions)) { |
|
$this->add($conditions, $this->getTypeMap()->getTypes()); |
|
} |
|
} |
|
|
|
/** |
continue; |
|
} |
|
|
|
if ($numericKey && $isArray || $isOperator) { |
|
$this->_conditions[] = new static($c, $typeMap, $numericKey ? 'AND' : $k); |
|
continue; |
|
} |
|
|
|
if ($isNot) { |
|
|
return $this; |
|
} |
|
|
|
$this->_addConditions($conditions, $types); |
|
|
|
return $this; |
|
} |
|
|
{ |
|
$this->setTypeMap($types); |
|
$this->setConjunction(strtoupper($conjunction)); |
|
if (!empty($conditions)) { |
|
$this->add($conditions, $this->getTypeMap()->getTypes()); |
|
} |
|
} |
|
|
|
/** |
continue; |
|
} |
|
|
|
if ($numericKey && $isArray || $isOperator) { |
|
$this->_conditions[] = new static($c, $typeMap, $numericKey ? 'AND' : $k); |
|
continue; |
|
} |
|
|
|
if ($isNot) { |
|
|
return $this; |
|
} |
|
|
|
$this->_addConditions($conditions, $types); |
|
|
|
return $this; |
|
} |
|
|
$append = $append($this->newExpr(), $this); |
|
} |
|
|
|
if ($expression->getConjunction() === $conjunction) { |
|
$expression->add($append, $types); |
|
} else { |
|
$expression = $this->newExpr() |
|
->setConjunction($conjunction) |
|
->add([$expression, $append], $types); |
{ |
|
if ($overwrite) { |
|
$this->_parts['where'] = $this->newExpr(); |
|
} |
|
$this->_conjugate('where', $conditions, 'AND', $types); |
|
|
|
return $this; |
|
} |
|
|
|
|
// Get documents filtered based on tenant settings |
|
$documents = $this->Documents->find() |
|
->innerJoinWith('Tenants', function ($q) use ($where) { |
|
return $q->where($where); |
|
}) |
|
->where(['Documents.active' => true]) |
|
->order(['Documents.created' => 'DESC']) |
|
->all(); |
->find($finder, $opts) |
|
->eagerLoaded(true); |
|
|
|
if (!empty($options['queryBuilder'])) { |
|
$dummy = $options['queryBuilder']($dummy); |
|
if (!($dummy instanceof Query)) { |
|
throw new RuntimeException(sprintf( |
|
'Query builder for association "%s" did not return a query', |
|
$this->getName() |
'aliasPath' => $loadable->aliasPath(), |
|
'propertyPath' => $loadable->propertyPath(), |
|
'includeFields' => $includeFields, |
|
]; |
|
$loadable->instance()->attachTo($query, $config); |
|
$processed[$alias] = true; |
|
} |
|
|
|
$newAttachable = $this->attachableAssociations($repository); |
if (empty($this->_parts['from'])) { |
|
$this->from([$repository->getAlias() => $repository->getTable()]); |
|
} |
|
$this->_addDefaultFields(); |
|
$this->getEagerLoader()->attachAssociations($this, $repository, !$this->_hasFields); |
|
$this->_addDefaultSelectTypes(); |
|
} |
|
|
|
/** |
public function sql(?ValueBinder $binder = null): string |
|
{ |
|
$this->triggerBeforeFind(); |
|
|
|
$this->_transformQuery(); |
|
|
|
return parent::sql($binder); |
|
} |
|
|
/** |
|
* @psalm-suppress PossiblyInvalidMethodCall |
|
* @psalm-suppress PossiblyInvalidArgument |
|
*/ |
|
$statement = $this->_connection->prepare($isObject ? $query->sql() : $query); |
|
$result = new MysqlStatement($statement, $this); |
|
/** @psalm-suppress PossiblyInvalidMethodCall */ |
|
if ($isObject && $query->isBufferedResultsEnabled() === false) { |
|
$result->bufferResults(false); |
{ |
|
$role = $query instanceof Query ? $query->getConnectionRole() : self::ROLE_WRITE; |
|
|
|
return $this->getDisconnectRetry()->run(function () use ($query, $role) { |
|
$statement = $this->getDriver($role)->prepare($query); |
|
|
|
if ($this->_logQueries) { |
|
$statement = $this->_newLogger($statement); |
|
} |
{ |
|
$this->numRetries = 0; |
|
while (true) { |
|
try { |
|
return $action(); |
|
} catch (Exception $e) { |
|
if ( |
|
$this->numRetries < $this->maxRetries && |
|
$this->strategy->shouldRetry($e, $this->numRetries) |
public function prepare($query): StatementInterface |
|
{ |
|
$role = $query instanceof Query ? $query->getConnectionRole() : self::ROLE_WRITE; |
|
|
|
return $this->getDisconnectRetry()->run(function () use ($query, $role) { |
|
$statement = $this->getDriver($role)->prepare($query); |
|
|
|
if ($this->_logQueries) { |
|
$statement = $this->_newLogger($statement); |
*/ |
|
public function run(Query $query): StatementInterface |
|
{ |
|
return $this->getDisconnectRetry()->run(function () use ($query) { |
|
$statement = $this->prepare($query); |
|
$query->getValueBinder()->attachTo($statement); |
|
$statement->execute(); |
|
|
|
return $statement; |
{ |
|
$this->numRetries = 0; |
|
while (true) { |
|
try { |
|
return $action(); |
|
} catch (Exception $e) { |
|
if ( |
|
$this->numRetries < $this->maxRetries && |
|
$this->strategy->shouldRetry($e, $this->numRetries) |
* @return \Cake\Database\StatementInterface executed statement |
|
*/ |
|
public function run(Query $query): StatementInterface |
|
{ |
|
return $this->getDisconnectRetry()->run(function () use ($query) { |
|
$statement = $this->prepare($query); |
|
$query->getValueBinder()->attachTo($statement); |
|
$statement->execute(); |
|
|
* @return \Cake\Database\StatementInterface |
|
*/ |
|
public function execute(): StatementInterface |
|
{ |
|
$statement = $this->_connection->run($this); |
|
$this->_iterator = $this->_decorateStatement($statement); |
|
$this->_dirty = false; |
|
|
|
return $this->_iterator; |
|
|
return new $decorator($this->_results); |
|
} |
|
|
|
$statement = $this->getEagerLoader()->loadExternal($this, $this->execute()); |
|
|
|
return new ResultSet($this, $statement); |
|
} |
|
|
if ($this->_cache) { |
|
$results = $this->_cache->fetch($this); |
|
} |
|
if ($results === null) { |
|
$results = $this->_decorateResults($this->_execute()); |
|
if ($this->_cache) { |
|
$this->_cache->store($this, $results); |
|
} |
|
} |
'You cannot call all() on a non-select query. Use execute() instead.' |
|
); |
|
} |
|
|
|
return $this->_all(); |
|
} |
|
|
|
/** |
|
* Trigger the beforeFind event on the query's repository object. |
return $q->where($where); |
|
}) |
|
->where(['Documents.active' => true]) |
|
->order(['Documents.created' => 'DESC']) |
|
->all(); |
|
|
|
// Get unique categories for filtering (following the same filtering logic) |
|
$categories = $this->Documents->find() |
|
->select(['category']) |
* @throws \UnexpectedValueException If return value of action is not `null` or `ResponseInterface` instance. |
|
*/ |
|
public function invokeAction(Closure $action, array $args): void |
|
{ |
|
$result = $action(...$args); |
|
if ($result !== null && !$result instanceof ResponseInterface) { |
|
throw new UnexpectedValueException(sprintf( |
|
'Controller actions can only return ResponseInterface instance or null. ' |
|
. 'Got %s instead.', |
$args = $this->getActionArgs( |
|
$action, |
|
array_values((array)$controller->getRequest()->getParam('pass')) |
|
); |
|
$controller->invokeAction($action, $args); |
|
|
|
$result = $controller->shutdownProcess(); |
|
if ($result instanceof ResponseInterface) { |
|
return $result; |
|
|
return $runner->run($middlewareQueue, $controller->getRequest(), $this); |
|
} |
|
|
|
return $this->handle($controller->getRequest()); |
|
} |
|
|
|
/** |
|
* Invoke the action. |
|
|
// This is needed for auto-wiring. Should be removed in 5.x |
|
$container->add(ComponentRegistry::class, $controller->components()); |
|
|
|
return $this->controllerFactory->invoke($controller); |
|
} |
|
} |
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
|
} |
|
|
|
return new Response([ |
|
'body' => 'Middleware queue was exhausted without returning a response ' |
} |
|
|
|
// Aucun tenant identifié mais on continue quand même |
|
// Cela permet à d'autres parties de l'application de fonctionner sans tenant |
|
return $handler->handle($request); |
|
} |
|
|
|
/** |
|
* Définir le tenant dans l'objet de requête |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
*/ |
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
{ |
|
if (!in_array($request->getMethod(), $this->methods, true)) { |
|
return $handler->handle($request); |
|
} |
|
[$type] = explode(';', $request->getHeaderLine('Content-Type')); |
|
$type = strtolower($type); |
|
if (!isset($this->parsers[$type])) { |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
); |
|
} |
|
$matching = Router::getRouteCollection()->getMiddleware($middleware); |
|
if (!$matching) { |
|
return $handler->handle($request); |
|
} |
|
|
|
$container = $this->app instanceof ContainerApplicationInterface |
|
? $this->app->getContainer() |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
{ |
|
$url = $request->getUri()->getPath(); |
|
if (strpos($url, '..') !== false || strpos($url, '.') === false) { |
|
return $handler->handle($request); |
|
} |
|
|
|
if (strpos($url, '/.') !== false) { |
|
return $handler->handle($request); |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
*/ |
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
{ |
|
try { |
|
return $handler->handle($request); |
|
} catch (RedirectException $exception) { |
|
return $this->handleRedirect($exception); |
|
} catch (Throwable $exception) { |
|
return $this->handleException($exception, $request); |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
) { |
|
Router::setRequest($request); |
|
} |
|
|
|
return $this->handle($request); |
|
} |
|
|
|
/** |
|
* Handle incoming server request and return a response. |
} |
|
|
|
$this->dispatchEvent('Server.buildMiddleware', ['middleware' => $middleware]); |
|
|
|
$response = $this->runner->run($middleware, $request, $this->app); |
|
|
|
if ($request instanceof ServerRequest) { |
|
$request->getSession()->close(); |
|
} |
// Bind your application to the server. |
|
$server = new Server(new Application(dirname(__DIR__) . '/config')); |
|
|
|
// Run the request/response through the application and emit the response. |
|
$server->emit($server->run()); |
|
|
If you want to customize this error message, create templates/Error/error500.php