mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-15 06:44:03 +00:00
[4.x] URL generation, request data identification improvements (#1357)
* UrlGenerator: set defaults based on config; request data: move config to config file+resolver * Claude code adjustments * improve request data tests, simplify complex test in UrlGeneratorBootstrapperTest * url generator test: test changing tenant parameter name * request data identification: add tenant_model_column configuration * defaultParameterNames -> passQueryParameter * move comment * minor refactor in PathIdentificationTest, expand CLAUDE.md to include early identification section * Fix COLOR_FLAG * improve test name Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * TenancyUrlGenerator: add a check for queryParameterName being null Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix code style (php-cs-fixer) --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
f4cc99b317
commit
5f7fd38e5a
13 changed files with 440 additions and 126 deletions
|
|
@ -67,13 +67,15 @@ class UrlGeneratorBootstrapper implements TenancyBootstrapper
|
|||
$defaultParameters = $this->originalUrlGenerator->getDefaultParameters();
|
||||
|
||||
if (static::$addTenantParameterToDefaults) {
|
||||
$defaultParameters = array_merge(
|
||||
$defaultParameters,
|
||||
[
|
||||
PathTenantResolver::tenantParameterName() => PathTenantResolver::tenantParameterValue($tenant), // path identification
|
||||
'tenant' => $tenant->getTenantKey(), // query string identification
|
||||
],
|
||||
);
|
||||
$tenantParameterName = PathTenantResolver::tenantParameterName();
|
||||
|
||||
$defaultParameters = array_merge($defaultParameters, [
|
||||
$tenantParameterName => PathTenantResolver::tenantParameterValue($tenant),
|
||||
]);
|
||||
|
||||
foreach (PathTenantResolver::allowedExtraModelColumns() as $column) {
|
||||
$defaultParameters["$tenantParameterName:$column"] = $tenant->getAttribute($column);
|
||||
}
|
||||
}
|
||||
|
||||
$newGenerator->defaults($defaultParameters);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue