MetaModels / core

MetaModels Core Module
GNU Lesser General Public License v3.0
96 stars 42 forks source link

Creating Variants: Alias of parent element is automatically included in variant, causing issues with unique values #1165

Open NakNakNaaak opened 7 years ago

NakNakNaaak commented 7 years ago

Checklist before I submit this issue report

I confirm that:

My environment is:

(Please fill in the actual values from your environment)

Key Value Comments
PHP version: 5.6.30
Contao version: 3.5.28
MetaModels version: 2.0.0-alpha15
Installation via composer: no
Installed MetaModels packages: nightly, notelist
DCG version: 2.0.0-beta39

Issue description

When creating variants of an item, the value in the alias field is automatically included based on the parent value. This, however, prevents MM from creating a new item, as variants should have an unique alias. In order to create variants, the parent's alias has to be removed manually (so that a new alias is created based on the rules as set in the alias settings of the MM.

Steps to reproduce

  1. create new MM
  2. add an alias attribute, hit "unique values" and assign attributes to be used for creating an alias
  3. create a new item in your MM
  4. create variants

Describe the behaviour of the application

When creating variants, MM will produce the following error:

The property "alias" is already in the database and not unique.

However, variants can be created once the pre-filled alias field has been cleared. Apparently, MM automatically uses the alias of the parent element, meaning that instead of creating a new alias, MM tries to create a variant-item with the same alias.

Describe the expected behaviour of the application

The alias field should ne contain any pre-defined information derived from the parent element so that a new alias can be created for variants.

Screenshots

(Add some visual love or even a video if you can)

zonky2 commented 3 years ago

We have discussed this in the MM call: there are advantages and disadvantages for regeneration or leave it as it is, so it should be adjustable which method is used