Update ORM.php

Enables the use of foreign keys as a unique_base, see #827