I have 4 entities. ArticleGroup, Article, WarehouseStok, Warehouse.
I need to fetch articleGroups which have articles(NSSet) which belong to warehouseStocks(NSSet) which belong to warehouse(single).
request.predicate = [NSPredicate predicateWithFormat:@"SUBQUERY(articles, $a, SUBQUERY($a.warehouseStocks, $y, $y.warehouse == %@))", warehouse];
I got this error:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "SUBQUERY(articles, $a, SUBQUERY($a.warehouseStocks, $y, $y.warehouse == %@))"'
How do I construct such a predicate? Is it possible at all?