[**Documentation**](../../../../README)

***

[Documentation](../../../../README) / [@zerotal/flow](../../README) / [index](../README) / registerFlowModel

# Function: registerFlowModel()

> **registerFlowModel**(`name`, `ModelClass`): `void`

Defined in: [flow/src/synths/ModelSynth.ts:39](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/flow/src/synths/ModelSynth.ts#L39)

Register an ORM model class under a stable name so the model synth can send it
across the wire: a model prop is dehydrated to its `id` (tagged with this name)
and hydrated back by re-fetching via `findOrFail`.

## Parameters

### name

`string`

Stable, developer-assigned name recorded in the snapshot's `meta.class`.

### ModelClass

*typeof* [`BaseModel`](../../../orm/index/classes/BaseModel)

The `BaseModel` subclass to associate with `name`.

## Returns

`void`

## Remarks

Registering by an explicit name (rather than `constructor.name`) keeps snapshots
valid under minification, where the class name may be mangled. You normally don't
call this directly — declare models in a component's `static models` map and the
framework registers them when the page is registered.

## Example

```tsx
class ShowPost extends Component {
  static models = { Post }; // auto-calls registerFlowModel("Post", Post)
  @locked post!: Post;      // survives the round-trip as a rehydrated model
}

// Or register manually (e.g. outside a page's static models):
registerFlowModel("Post", Post);
```
