ModelRefImpl

DORM field type representing a referenced model through a foreign key in SQL.

The actual data stored in the DB as foreign key is what's stored in the foreignKey member. The populated property is simply a cache member for supporting proactively fetched joined data from the database. Trying to access the populated data without having it populated will result in a program crash through assert(false).

Members

Aliases

PrimaryKeyType
alias PrimaryKeyType = typeof(primaryKeyAlias)
Undocumented in source.
TModel
alias TModel = _TModel
Undocumented in source.
TSelect
alias TSelect = _TSelect
Undocumented in source.
primaryKeyAlias
alias primaryKeyAlias = id
Undocumented in source.

Functions

isPopulated
bool isPopulated()
opAssign
auto opAssign(TSelect value)

Sets the populated value as well as the foreign key for saving in the DB.

populated
TSelect populated()
refersTo
bool refersTo(TModel other)
bool refersTo(TSelect other)

Returns true if other's primary key is equal to the foreign key stored in this ModelRef instance. Does not check any other fields. Does not require this ModelRef to be populated.

Manifest constants

primaryKeyColumnName
enum primaryKeyColumnName;
Undocumented in source.
primaryKeySourceName
enum primaryKeySourceName;
Undocumented in source.

Variables

foreignKey
PrimaryKeyType foreignKey;

The actual data stored in the DB field. Can be manipulated manually to perform special operations not supported otherwise.

Bugs

db.populate(ModelRef) is not yet implemented

Meta