Skip to content

Conversation

kingjia90
Copy link
Contributor

@kingjia90 kingjia90 commented Jun 23, 2025

Changes in this pull request

Resolves https://github.com/pimcore/service-operations/issues/141

Additional info

Adding a new array of baseunit (units without depending baseunits, that could be depended by other units as a base) that is imported before any other to avoid foreign key errors, the array_unshift alone didn't work well in some json where there are units with base unit depending on an unit with another base unit (nested)

Copy link

Review Checklist

  • Target branch (11.5 for bug fixes, others 11.x)
  • Tests (if it's testable code, there should be a test for it - get help)
  • Docs (every functionality needs to be documented, see here)
  • Migration incl. install.sql (e.g. if the database schema changes, ...)
  • Upgrade notes (deprecations, important information, migration hints, ...)
  • Label
  • Milestone

Copy link

@kingjia90
Copy link
Contributor Author

kingjia90 commented Jun 23, 2025

Reproduce

Example json

[
    {
        "dao": null,
        "id": "in",
        "abbreviation": "in",
        "group": "",
        "longname": "inch",
        "baseunit": null,
        "reference": "",
        "factor": null,
        "conversionOffset": null,
        "converter": ""
    },
    {
        "dao": null,
        "id": "mm",
        "abbreviation": "mm",
        "group": "",
        "longname": "Millimeter",
        "baseunit": "cm",
        "reference": "",
        "factor": 0.1,
        "conversionOffset": null,
        "converter": ""
    },
    {
        "dao": null,
        "id": "m",
        "abbreviation": "m",
        "group": "",
        "longname": "Meter",
        "baseunit": "cm",
        "reference": "",
        "factor": 100,
        "conversionOffset": null,
        "converter": ""
    },
    {
        "dao": null,
        "id": "cm",
        "abbreviation": "cm",
        "group": "",
        "longname": "centimetre",
        "baseunit": "in",
        "reference": "",
        "factor": 0.3937007874,
        "conversionOffset": null,
        "converter": ""
    }
]
bin/console definition:import:units <jsonpath>

Before PR it goes cm,inch,mm,m (as cm gets unshifted) after PR it imports the inch which is depended by cm before anything else

@kingjia90 kingjia90 self-assigned this Jun 26, 2025
@kingjia90 kingjia90 merged commit b594e2f into 11.5 Jun 26, 2025
20 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jun 26, 2025
@kingjia90 kingjia90 deleted the fix-qty-value-order branch July 4, 2025 05:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant