Hello, is it possible to perform some form of filt...
# exposed
g
Hello, is it possible to perform some form of filtering in DAO references?
For example:
Copy code
class UserRating(id: EntityID<Int>) : IntEntity(id) {
    companion object : IntEntityClass<UserRating>(UserRatings)
    var value by UserRatings.value
    var film by StarWarsFilm.referencedOn(UserRatings.film, where = {StarWarsFilm.id eq 2 }) 
    var user by User referencedOn UserRatings.user
}
o
Hi, thank you for highlighting, it looks like there is no such a possibility, or at least I can not find it. I remember that about month ago was added ordering for references (kind of
var column by Entity referrersOn Table.column orderBy Table.anotherColumn
) So probably we should think about filtering of them also.
👍 1
Created an issue EXPOSED-462 Filtering on entity references It looks pretty feasible, hope there are no underlying obstacles I don't see now)
g
Great, thanks for looking into this!
l
hi :) made a PR for filtering
referrersOn
and
optionalReferrersOn
references in DAO: https://github.com/JetBrains/Exposed/pull/2472
@Oleg Babichev could you take a look at the pr pls? https://github.com/JetBrains/Exposed/pull/2472