Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Entities retrieved via repository can not be upserted again #8

@beyer-ps

Description

@beyer-ps

PHP Version

No response

Shopware Version

No response

Plugin Version

No response

Actual behaviour

Hi,

I want to create a CLI to simply copy CMS Pages between Shopware instances.
Therefore I use the CmsPage Repository to search for a certain Page including associated entities (e.g. CmsSection, CmsBlock, etc.) on one shopware-instance and upload the CmsPage using Upsert to another.

I've encountered the problem that the field "Position" in "CmsBlock", which is a required numeric value and apparently allowed to be 0, is annotated with "omitempty" and therefore not included in the Upsert Payload.

Same problem occurs with other entities and changing those annotation (removing "omitempty") solves the specific issue.

Is that "omitempty" annotation for required numeric fields intentional?

Expected behaviour

Required numeric fields (like Position) should be allowed to be 0 in order to upsert them again without errors.

Steps to Reproduce?

Retrieve a CmsBlock with Position 0 using the CmsBlock Repository and upsert the same data again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions