Skip to content

Same alias at root level in different websites is not possible #413

Description

@hbugdoll

After #411 we have the following situation now:

Same alias is prevented

  1. with same parent item
  2. or at root level ("same" parent_nav_id = 0).
/* this is possible */                /* this is NOT possible */

Website1                              Website1
├── alias_a                           ├── alias_a
│    ├── alias_b                      │    ├── alias_c
│    └── alias_c                      │    └── alias_c ↯
├── alias_b                           ├── alias_b
│    └── alias_c                      │    └── alias_c
└── alias_c                           └── alias_a ↯

That is the desired behavior.


But there is no support of multiple websites in verifyAlias().
The GROUP BY clause

->groupBy('cms_nav_container.website_id')
doesn't reach it. In my opinion this clause can be omitted because of the presence of ->exists().

Currently, it's not possible to have two pages at root level with same alias but in different websites,
because of "same" parent_nav_id = 0.

/* this is currently NOT possible */

Website1
├── homepage
├── alias_a
│    └── alias_c
└── alias_b

Website2
├── homepage ↯
├── alias_c
│    └── alias_d 
└── alias_b ↯

The WHERE clause

->where(['cms_nav_item.alias' => $alias, 'cms_nav_item.lang_id' => $langId, 'cms_nav.parent_nav_id' => $parentNavId])
should be something like
->where(['cms_nav_item.alias' => $alias, 'cms_nav_item.lang_id' => $langId, 'cms_nav.parent_nav_id' => $parentNavId, 'cms_nav_container.website_id' => $websiteId]) and $websiteId must be provided in verifyAlias().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions