What am I doing wrong? This is with latest 0.50 daily build. The last log statement at the end fails with:
Uncaught Error: Invalid value for argument: oneFn Value: undefined
In persistence.js when calling itemone.children.one()
----CODE-----
application Problems
import mobl::ui::generic
screen root() {
header("Problems")
script {
//resetDatabase();
init();
}
}
entity Item1 {
name : String
children : Collection<Item2> (inverse: parent)
}
entity Item2 {
name : String
parent : Item1 (inverse: children)
}
function init ()
{
var item = Item1.all().one();
if(item == null)
{
log("creating!");
var it2 = Item2();
var it1 = Item1();
it2.parent = it1;
add(it1);
it1.children.add(it2);
// I've tried doing with or without explicitly adding it2.
}
var itemone = Item1.all().one();
log("itemone child: " + itemone.children.one().name);
}