Skip to content

Custom Model Classes - #487

Merged
igorT merged 1 commit into
emberjs:masterfrom
igorT:igor/custom-model-classes
Jun 29, 2019
Merged

Custom Model Classes#487
igorT merged 1 commit into
emberjs:masterfrom
igorT:igor/custom-model-classes

Conversation

@igorT

@igorTigorT commented May 9, 2019

Copy link
Copy Markdown
Member

@runspiredrunspired added the T-ember-data RFCs that impact the ember-data library label May 9, 2019
@tchak

This comment has been minimized.

Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
kind: 'hasMany'| 'belongsTo';
type: string;
options: { [key: string]: any } ;
name: string;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should validate that this is in fact what we currently expose / want to document as info concerning inversePropertyNameinverseType and isPolymorphic is typically available as well.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats a very good point. isPolymorphic should be available from the options. We currently in practice expose a bunch of underscored properties for inverses, but all of that data is calculable given the exposed public data. I would prefer to keep it private, and figure out in the schema work if we need to expose it

Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
@igorTigorT changed the title [Data] Custom Model ClassesCustom Model ClassesMay 15, 2019
@igorT
igorTforce-pushed the igor/custom-model-classes branch 2 times, most recently from 959be70 to 10ade6fCompareMay 22, 2019 19:59
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md
Comment threadtext/0000-custom-model-classes.md
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md
Comment threadtext/0000-custom-model-classes.md
@igorT

This comment has been minimized.

Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
@igorT

This comment has been minimized.

@dgeb

dgeb commented Jun 19, 2019

Copy link
Copy Markdown
Member

I discussed this with @igorT today.

One concern I've had here is that type is used inconsistently between RelationshipDefinition and AttributeDefinition, but Igor said that this is a legacy inconsistency and that changing this now would lead to breakages.

Also, some method return values on RecordDataWrapper are untyped (e.g. getErrors, getMeta).

I'm fine moving this to FCP if others are. I will give it another pass over the weekend.

@igorT
igorTforce-pushed the igor/custom-model-classes branch from 47a6f8c to c6c4e85CompareJune 19, 2019 20:17
@igorT

Copy link
Copy Markdown
MemberAuthor

I have implemented a slightly older version of this api(pending some cleanup) at ember-m3/ember-m3#294. It passes all the tests without any usage of _internalModel or other private apis

Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
Comment threadtext/0000-custom-model-classes.md Outdated
}
```

Instead of exposing the entire RecordData Class, we expose only the local facing methods and hide the server/adapter facing methods that the Model should not have access to, by giving a RecordData lookup method to `instantiateRecord`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of exposing the entire RecordData Class

On what? Needs a slight prose tweak here

@emberjsemberjs deleted a comment from rwjblueJun 19, 2019
Comment threadtext/0000-custom-model-classes.md Outdated
We need to make the following changes:

* expose a method on the store for instantiating a record
* add a hook to be notified when a record is being destroyed for potential cleanup

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify interaction with unloadRecord

Comment threadtext/0000-custom-model-classes.md Outdated
@dgeb

dgeb commented Jun 23, 2019

Copy link
Copy Markdown
Member

I've left a couple suggestions but don't consider anything blocking.

In addition to the comments I left, I'd like to eventually iron out inconsistencies between usage of type in the relationship and attribute definitions, but I understand those interfaces are not being introduced by this RFC.

@igorT
igorTforce-pushed the igor/custom-model-classes branch 2 times, most recently from 3575893 to 3a8b8b6CompareJune 29, 2019 03:39
@igorT
igorTforce-pushed the igor/custom-model-classes branch from 3a8b8b6 to d8d46ddCompareJune 29, 2019 03:41
@igorT
igorT merged commit a418eaa into emberjs:masterJun 29, 2019
igorT added a commit to warp-drive-data/warp-drive that referenced this pull request Aug 20, 2019
igorT pushed a commit to ember-m3/ember-m3 that referenced this pull request Sep 28, 2019
This allows us to move away from using _internalModel and private apis, by using apis descibred at
emberjs/rfcs#487
igorT pushed a commit to ember-m3/ember-m3 that referenced this pull request Sep 28, 2019
This allows us to move away from using _internalModel and private apis, by using apis descibred at
emberjs/rfcs#487
igorT pushed a commit to ember-m3/ember-m3 that referenced this pull request Sep 28, 2019
This allows us to move away from using _internalModel and private apis, by using apis descibred at
emberjs/rfcs#487
igorT pushed a commit to ember-m3/ember-m3 that referenced this pull request Sep 28, 2019
This allows us to move away from using _internalModel and private apis, by using apis descibred at
emberjs/rfcs#487
igorT pushed a commit to ember-m3/ember-m3 that referenced this pull request Sep 28, 2019
This allows us to move away from using _internalModel and private apis, by using apis descibred at
emberjs/rfcs#487
wagenet added a commit that referenced this pull request Mar 13, 2023
bmish added a commit to bmish/emberjs-rfcs that referenced this pull request May 21, 2023
* master: (56 commits)
Fix code examples & add ember-cli release version in emberjs#637
Update FCP guidance to include Discord
Update RFC 085421 ready-for-release PR URL
Advance RFC {{ inputs.rfc-number }} to Stage ready-for-release
feat: EmberData Cache v2.1
finalize lifetimes
Update text/0860-ember-data-request-service.md
Update RFC 496, typos, correct field name
add note
chore: update RequestService url with finalized design details
Move emberjs#331 deprecate-globals-resolver to recommended
Correct metadata for emberjs#487 custom model classes
Move emberjs#625 helper-managers to recommended
Add release date and version for 776
Update RFC 0776 released PR URL
Advance RFC {{ inputs.rfc-number }} to Stage released
Update RFC 0739 ready-for-release PR URL
Advance RFC {{ inputs.rfc-number }} to Stage ready-for-release
Deprecate `ember-mocha`
Add title of RFC to advancement PR titles
...
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Final Comment PeriodT-ember-dataRFCs that impact the ember-data library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@igorT@tchak@dgeb@rwjblue@hjdivad@HeroicEric@runspired