# OneToOneAssociation Inherited is not working in frontend

**URL:** https://forum.shopware.com/t/onetooneassociation-inherited-is-not-working-in-frontend/97280
**Category:** Programming (EN)
**Tags:** general, programming
**Created:** [25. November 2022 um 05:19 UTC](https://forum.shopware.com/t/onetooneassociation-inherited-is-not-working-in-frontend/97280 "2022-11-25T05:19:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![abinjohnedamana](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/abinjohnedamana/32/17378_2.png) [@abinjohnedamana](https://forum.shopware.com/u/abinjohnedamana)
#### Post date: [25. November 2022 um 05:19 UTC](https://forum.shopware.com/t/onetooneassociation-inherited-is-not-working-in-frontend/97280/1 "2022-11-25T05:19:55Z")

</div>

I have created 2 tables like the following

```auto
            
CREATE TABLE IF NOT EXISTS `swag_product_extension`(
    `id` BINARY(16) NOT NULL,
    `product_id` BINARY(16) NOT NULL,
    `product_version_id` BINARY(16) NOT NULL,
    `created_at` DATETIME(3) NOT NULL,
    `updated_at` DATETIME(3) NULL,
    PRIMARY KEY(`id`),
    CONSTRAINT `fk.swag_product_extension.product_id` FOREIGN KEY(`product_id`, `product_version_id`) REFERENCES `product`(`id`, `version_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `swag_product_extension_translation`(
    `swag_product_extension_id` BINARY(16) NOT NULL,
    `language_id` BINARY(16) NOT NULL,
    `info` VARCHAR(255) NULL,
    `created_at` DATETIME(3) NOT NULL,
    `updated_at` DATETIME(3) NULL,
    PRIMARY KEY(
        `swag_product_extension_id`,
        `language_id`
    ),
    CONSTRAINT `fk.swag_product_extension_translation.swag_product_extension_id` FOREIGN KEY(`swag_product_extension_id`) REFERENCES `swag_product_extension`(`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT `fk.swag_product_extension_translation.language_id` FOREIGN KEY(`language_id`) REFERENCES `language`(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

$this->updateInheritance($connection, 'product', 'productExtension');

```

Then i extended the product entity using EntityExtension

```auto
  $collection->add(
            (new OneToOneAssociationField(
                'productExtension', 
                'id',
                'product_id',
                ProductExtensionDefinition::class,
                true
            ))->addFlags(new Inherited())
        );

```

ProductExtensionDefinition

```auto
        return new FieldCollection(
            [
                (new IdField('id', 'id'))->addFlags(new ApiAware(), new Required(), new PrimaryKey()),
                (new FkField('product_id', 'productId', ProductDefinition::class))->addFlags(new ApiAware(), new Required()),
                (new ReferenceVersionField(ProductDefinition::class))->addFlags(new Required()),
                (new TranslatedField('info'))->addFlags(new ApiAware()),
                (new TranslationsAssociationField(
                    ProductExtensionTranslationDefinition::class,
                    'swag_product_extension_id'))->addFlags(new ApiAware()),
                (new OneToOneAssociationField('product', 'product_id', 'id', ProductDefinition::class, false))->addFlags(new ReverseInherited('productExtension'))
            ]);

```

ProductExtensionTranslationDefinition

```auto
protected function defineFields(): FieldCollection
{
return new FieldCollection([
    (new StringField('info', 'info'))->addFlags(new ApiAware())
]);
}

```

The inheritance is working fine in the backend

But inheritance not working in the front end

Any solution for this issue?
