Reputation: 787
I'm trying to create a relation between Product2Componen
<relation code="Product2Components" localized="false" autocreate="true">
<deployment table="ProdsCompRels" typecode="30008" />
<sourceElement qualifier="product" type="Product" cardinality="one" collectiontype="list">
<modifiers read="true" write="true" search="true" optional="true" />
</sourceElement>
<targetElement qualifier="components" type="SimpleCMSComponent" cardinality="many">
<modifiers read="true" write="true" search="true" optional="true" />
</targetElement>
</relation>
However , hybris OOTB has already a relation within product2ProductDetailComponent:
<relation code="ProductDetailComponentsForProduct" generate="true" localized="false" autocreate="true">
<sourceElement qualifier="productDetailComponents" type="ProductDetailComponent" cardinality="many" collectiontype="list">
<modifiers read="true" write="true" search="true" optional="true" />
</sourceElement>
<targetElement qualifier="product" type="Product" cardinality="one">
<modifiers read="true" write="true" search="true" optional="true" />
</targetElement>
</relation>
And when I compile it returns me this error because of this already existing relation that is completly useless to me:
Attribute CmsLinkComponent.product(Product):((cms2))::YAttributeDescriptor[cms2-items.xml:190(RelationTypeTagListener)][JALO] duplicates inherited attribute SimpleCMSComponent.product(Product):((puigcore))::YAttributeDescriptor[puigcore-items.xml:488(RelationTypeTagListener)][JALO]. Remove it or specify it as redeclared
How can I redeclare a relation ? Or what should I do here ?
Upvotes: 2
Views: 1374
Reputation: 5810
Since the OOTB ProductDetailComponent extends SimpleCMSComponent and you want to use SimpleCMSComponent so I think you can simply use OOTB relation.
But if you really want to decare your own attribute/relation then you have to provide a different qualifier other than "product", as the product qualifier is already been used in the OOTB relation ProductDetailComponentsForProduct
, where ProductDetailComponent is the subtype of SimpleCMSComponent.
<relation code="Product2Components" localized="false" autocreate="true">
<deployment table="ProdsCompRels" typecode="30008" />
<sourceElement qualifier="productRef" type="Product" cardinality="one" collectiontype="list">
<modifiers read="true" write="true" search="true" optional="true" />
</sourceElement>
<targetElement qualifier="components" type="SimpleCMSComponent" cardinality="many">
<modifiers read="true" write="true" search="true" optional="true" />
</targetElement>
</relation>
Upvotes: 4