Good day,
I have created an extension for the Customer Entity. Everything works as it should so far. Now, I want to filter customers in a component based on a specific ID in this extension. I can search by any other field, but as soon as I reference an ID field, I get no results.
Works:
criteriaCustomer.addFilter(
Criteria.equals('customer.extensions.customerExtension.company_id', this.company.name)
);
Doesn’t work:
criteriaCustomer.addFilter(
Criteria.equals('customer.extensions.customerExtension.id', "18d034570b9e4cca9b1dc761bb8d794d")
);
Searching the Customer Repository by an ID using the same filter works:
criteriaCustomer.addFilter(
Criteria.equals('id', "18d034570b9e4cca9b1dc761bb8d794d")
);
Field Collection:
return new FieldCollection([
(new IdField('id', 'id'))->addFlags(new ApiAware(), new Required(), new PrimaryKey()),
new FkField('customer_id', 'customerId', CustomerDefinition::class),
(new StringField('betreuer', 'betreuer')),
(new IdField('company_id', 'company_id'))->addFlags(new ApiAware()),
(new StringField('company_name', 'company_name')),
(new BoolField('company_account', 'company_account')),
new OneToOneAssociationField('customer', 'customer_id', 'id', CustomerDefinition::class, false)
]);
I suspect that the ID is passed as a string, and thus the query is executed as such. Have I made an obvious mistake here? Have I forgotten to declare something for the ID fields?
I am grateful for any help, and I wish you a great weekend in advance!