Options
All
  • Public
  • Public/Protected
  • All
Menu

Describes all relation's options.

Hierarchy

  • RelationOptions

Index

Properties

Optional cascade

cascade: boolean | ("insert" | "update" | "remove")[]

Sets cascades options for the given relation. If set to true then it means that related object can be allowed to be inserted or updated in the database. You can separately restrict cascades to insertion or updation using following syntax:

cascade: ["insert", "update"] // include or exclude one of them

Optional eager

eager: undefined | true | false

Set this relation to be eager. Eager relations are always loaded automatically when relation's owner entity is loaded using find* methods. Only using QueryBuilder prevents loading eager relations. Eager flag cannot be set from both sides of relation - you can eager load only one side of the relationship.

Optional lazy

lazy: undefined | true | false

Set this relation to be lazy. Note: lazy relations are promises. When you call them they return promise which resolve relation result then. If your property's type is Promise then this relation is set to lazy automatically.

Optional nullable

nullable: undefined | true | false

Indicates if relation column value can be nullable or not.

Optional onDelete

onDelete: OnDeleteType

Database cascade action on delete.

Optional onUpdate

onUpdate: OnUpdateType

Database cascade action on update.

Optional persistence

persistence: undefined | true | false

Indicates if persistence is enabled for the relation. By default its enabled, but if you want to avoid any changes in the relation to be reflected in the database you can disable it. If its disabled you can only change a relation from inverse side of a relation or using relation query builder functionality. This is useful for performance optimization since its disabling avoid multiple extra queries during entity save.

Optional primary

primary: undefined | true | false

Indicates if this relation will be a primary key. Can be used only for many-to-one and owner one-to-one relations.

Generated using TypeDoc