Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): do not set EM to entity until merging [BC] #270

Merged
merged 2 commits into from
Dec 14, 2019
Merged

Conversation

B4nan
Copy link
Member

@B4nan B4nan commented Dec 13, 2019

Previously all entities had internal reference to the root EM - the one created when
initializing the ORM. Now only managed entities (those merged to the EM, e.g. loaded
from the database) have this internal reference.

To use assign() method on new (not managed) entities, you need to provide the em
parameter:

const book = new Book();
wrap(book).assign(data, { em: orm.em });

Closes: #267

Previously all entities had internal reference to the root EM - the one created when
initializing the ORM. Now only managed entities (those merged to the EM, e.g. loaded
from the database) have this internal reference.

To use `assign()` method on new (not managed) entities, you need to provide the `em`
parameter:

```typescript
const book = new Book();
wrap(book).assign(data, { em: orm.em });
```

Closes: #267
@B4nan B4nan merged commit d09c3ab into master Dec 14, 2019
@B4nan B4nan deleted the internal-em branch December 14, 2019 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IdentifiedRef.load broke in 3.0.0-rc.1
1 participant