# Versioned order extension doesn't set order\_version\_id and doesn't read data in frontend controller

**URL:** <https://forum.shopware.com/t/versioned-order-extension-doesnt-set-order-version-id-and-doesnt-read-data-in-frontend-controller/105024>\
**Category:** Shopware 6 (English)\
**Created:** [30. August 2024 um 08:10 UTC](https://forum.shopware.com/t/versioned-order-extension-doesnt-set-order-version-id-and-doesnt-read-data-in-frontend-controller/105024 "2024-08-30T08:10:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![filip](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@filip](https://forum.shopware.com/u/filip)\
**Post date:** [30. August 2024 um 08:10 UTC](https://forum.shopware.com/t/versioned-order-extension-doesnt-set-order-version-id-and-doesnt-read-data-in-frontend-controller/105024/1 "2024-08-30T08:10:20Z")

</div>

Hi,

We are developing an internal plugin that adds new fields as a extension to orders.

The extension definition’s `defineFields` is:

```auto
    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new IdField('id', 'id'))->addFlags(new Required(), new PrimaryKey()),
            new VersionField(),
            new ReferenceVersionField(OrderDefinition::class, 'order_version_id'),
            new FkField('order_id', 'orderId', OrderDefinition::class),
            (new JsonField('external_status', 'extensionStatus')),
            (new OneToOneAssociationField('order', 'order_id', 'id', OrderDefinition::class, false))->addFlags(new ReverseInherited('productExtension'))->addFlags(new ApiAware()),
        ]);
    }

```

When saving data with:

```auto
        $this->orderRepository->update([
          [
            "id"=>$order->getId(),
            "extensions"=>[
              "externalOrder"=>[
                "externalStatus"=>["id"=>$id, "warehouses"=>$warehouseResponses],
              ],
            ]
          ]
        ], $this->context);

```

The `order_version_id` field doesn’t get set, and then when trying to read the data, `$order->hasExtension("externalOrder")` returns `false`.

Is there anything missing in the FieldCollection above?

Thank you.
