JohnV
04/28/2019, 7:59 PMobject Articles : IntIdTable() {
val title = text("title")
val intro = text("intro")
val image = text("image")
val date = text("date")
val author = text("author")
val url = text("url").index()
}
object Blocks : IntIdTable() {
val articleId = reference("article_id", Articles.id, ReferenceOption.CASCADE)
val type = enumeration("type", ContentType::class)
val content = text("content")
}
class Article(id: EntityID<Int>) : IntEntity(id) {
var title by Articles.title
--->var blocks by Block referrersOn Blocks.articleId<---
companion object : IntEntityClass<Article>(Articles)
}
class Block(id: EntityID<Int>) : IntEntity(id) {
val articleId by Article referencedOn Articles.id
val type by Blocks.type
val content by Blocks.content
companion object : IntEntityClass<Block>(Blocks)
}
In the Article class, I am trying to reference a list of blocks