hasOnerelationship is a "one-to-one" relationship. For instance, a
Userentity might have an
UserProfileentity attached to it.
hasOneis a WireBox mapping to the related entity.
UserProfileentity is assumed to have a
userIdforeign key. You can override this by passing a foreign key in as the second argument:
idas its primary key, or you wish to join the child entity to a different column, you may pass a third argument to the
hasOnemethod specifying your parent table's custom key.
HasOnerelationships can be configured to return a default entity if no entity is found. This is done by calling
withDefaulton the relationship object.