# Class: Branch

## Branch()

Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple parents.

## Constructor

#### new Branch()

Source:
  - becca/entities/branch.js, line 18

### Extends

- AbstractEntity

### Members

#### branchId :string

##### Type:

- string

Source:
  - becca/entities/branch.js, line 49

#### childNote

Source:
  - becca/entities/branch.js, line 94

#### isExpanded :boolean

##### Type:

- boolean

Source:
  - becca/entities/branch.js, line 59

#### noteId :string

##### Type:

- string

Source:
  - becca/entities/branch.js, line 51

#### notePosition :int

##### Type:

- int

Source:
  - becca/entities/branch.js, line 57

#### parentNote

Source:
  - becca/entities/branch.js, line 108

#### parentNoteId :string

##### Type:

- string

Source:
  - becca/entities/branch.js, line 53

#### prefix :string

##### Type:

- string

Source:
  - becca/entities/branch.js, line 55

#### utcDateModified :string

##### Type:

- string

Source:
  - becca/entities/branch.js, line 61

### Methods

#### deleteBranch(deleteIdopt, taskContextopt) → {boolean}

Delete a branch. If this is a last note's branch, delete the note as well.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`deleteId` | string | <optional> | optional delete identified
`taskContext` | TaskContext | <optional> |

Source:
  - becca/entities/branch.js, line 129

##### Returns:

- true if note has been deleted, false otherwise

Type
  boolean

#### markAsDeleted(deleteIdopt)

Mark the entity as (soft) deleted. It will be completely erased later. This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`deleteId` |  | <optional> | null |

Overrides:
  - AbstractEntity#markAsDeleted
Source:
  - becca/entities/abstract_entity.js, line 118

#### save() → {AbstractEntity}

Saves entity - executes SQL, but doesn't commit the transaction on its own

Overrides:
  - AbstractEntity#save
Source:
  - becca/entities/abstract_entity.js, line 73

##### Returns:

Type
  AbstractEntity