使用api平台过滤具有继承性的实体

时间:2020-03-18 10:01:55

标签: symfony doctrine api-platform.com

我使用API​​平台。

我有2个实体(ProductX和ProductY),继承自Product(继承类型:JOINED)。 我需要在过滤器的ProductX或productY字段上添加条件。但是查询生成器不会显示该实体。加入连接后(通过边缘加载?)。

如何过滤此实体?

1 个答案:

答案 0 :(得分:0)

您可以使用 API 平台 custom filter 并在其中编写 Product 和 ProductX 之间的连接。

train['DAYS_EMPLOYED'] =  (train.groupby(['NAME_EDUCATION_TYPE', 'OCCUPATION_TYPE', 'AGE_GROUP'],
                                         dropna=False)
                                ['DAYS_EMPLOYED']
                                .apply(lambda x: x.fillna(train['DAYS_EMPLOYED'].median()))
                          )