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

Custom Model Classes #487

Merged
merged 1 commit into from
Jun 29, 2019
Merged

Conversation

igorT
Copy link
Member

@igorT igorT commented May 9, 2019

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

This comment has been minimized.

kind: 'hasMany'| 'belongsTo';
type: string;
options: { [key: string]: any } ;
name: string;
Copy link
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 inversePropertyName inverseType and isPolymorphic is typically available as well.

Copy link
Member Author

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

@igorT igorT changed the title [Data] Custom Model Classes Custom Model Classes May 15, 2019
@igorT igorT force-pushed the igor/custom-model-classes branch 2 times, most recently from 959be70 to 10ade6f Compare May 22, 2019 19:59
text/0000-custom-model-classes.md Outdated Show resolved Hide resolved
text/0000-custom-model-classes.md Outdated Show resolved Hide resolved
text/0000-custom-model-classes.md Outdated Show resolved Hide resolved
text/0000-custom-model-classes.md Outdated Show resolved Hide resolved
text/0000-custom-model-classes.md Outdated Show resolved Hide resolved
@igorT

This comment has been minimized.

@igorT

This comment has been minimized.

@dgeb
Copy link
Member

dgeb commented Jun 19, 2019

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 igorT force-pushed the igor/custom-model-classes branch from 47a6f8c to c6c4e85 Compare June 19, 2019 20:17
@igorT
Copy link
Member Author

igorT commented Jun 19, 2019

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

text/0000-custom-model-classes.md Outdated Show resolved Hide resolved
text/0000-custom-model-classes.md Outdated Show resolved Hide resolved
text/0000-custom-model-classes.md Outdated Show resolved Hide resolved
text/0000-custom-model-classes.md Outdated Show resolved Hide resolved
text/0000-custom-model-classes.md Outdated Show resolved Hide resolved
text/0000-custom-model-classes.md Outdated Show resolved Hide resolved
text/0000-custom-model-classes.md Outdated Show resolved Hide resolved
}
```

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
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

@emberjs emberjs deleted a comment from rwjblue Jun 19, 2019
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
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

@dgeb
Copy link
Member

dgeb commented Jun 23, 2019

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 igorT force-pushed the igor/custom-model-classes branch 2 times, most recently from 3575893 to 3a8b8b6 Compare June 29, 2019 03:39
@igorT igorT force-pushed the igor/custom-model-classes branch from 3a8b8b6 to d8d46dd Compare June 29, 2019 03:41
@igorT igorT merged commit a418eaa into emberjs:master Jun 29, 2019
igorT added a commit to emberjs/data 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Final Comment Period T-ember-data RFCs that impact the ember-data library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants