Improved ORM::toArray() and ORM::toJson()
Merge branch '4.0'