is there a way to define and use a to-many relationship, derived from a modelled one, by limiting the results by a qualifier?
I have got an entity, say, "DBTable", whose to-many relationship "records" returns a set of eos of entity "DBRecord". That works all right.
Now, I need to implement a "qualifiedRecords" relationship, which would work this way:
NSArray qualifiedRecords {
EOQualifier qq=ERXSession.session().recordQualifier; // the qualifier depends on current user and other conditions of the current session
return EOQualifier.filteredArrayWithQualifier(this.records(),qq);
With small objects, I would use precisely the code above. Alas, my DBTables contain _lots_ of DBRecords, and thus the above implementation would get terribly slow by fetching all of them and then re-filtering them each time the relationship
is accessed.
What I need here is same behaviour functionality-wise, but at a lower level, sort of like EODatabaseDataSource's auxiliaryQualifier, but somehow bound to the particular relationship, so that
(a) it is not needed to fetch all records -- the "qualifiedRecords" relationship would, when fired, automatically fetch only the qualified ones
(b) records are fetched once and then cached, just like it is with normal relationships
(c) I can use things like
ERXEOControlUtilities.objectCountForToManyRelationship(sometable,"qualifiedRecords")
etc. seamlessly, and they work as expected.
Is there a way to do this at all? Perhaps I am just blind, but I cannot find any decent solution :/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Help/Unsubscribe/Update your Subscription: