Skip to content

Update 0000-find-polymorphism.md - #244

Closed
BryanCrotaz wants to merge 1 commit into
emberjs:polymorphismfrom
BryanCrotaz:patch-1
Closed

BryanCrotaz wants to merge 1 commit into
emberjs:polymorphismfrom
BryanCrotaz:patch-1

Conversation

@BryanCrotaz

Copy link
Copy Markdown

Add proposal for automatic hierarchy discovery

Add proposal for automatic hierarchy discovery
@xaqq

xaqq commented Aug 16, 2017

Copy link
Copy Markdown

Hello,

I never understood why this wasn't either the default behavior or available through some other means.
If anything, I don't agree with your propose to have to add a { polymorphic: true }, I strongly believe this should be the default behavior.

Hopefully if this RFC is implemented we may finally have a non broken store in EmberJS !

`hasMany({ polymorphic: true })` (and we just released 1.0 :( ) or to use an inconsistent mixed approach.


## Auto discovery of heirarchy

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I believe heirarchy should be spelled hierarchy.


## Auto discovery of heirarchy

The above would be much improved with auto discovery of heirarchy. This would remove the need for `abstractBaseClass` and the `polymorphic` flag on `find` etc could be inferred from whether a class has any descendants.

@thomascchen thomascchen Aug 24, 2017 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

heirarchy -> hierarchy here too 🙂

@sandstrom

Copy link
Copy Markdown
Contributor

Polymorphism for queries would be very useful!

Random thoughts:

  • How about an adapter-level property assumePolymorphism: true/false. That way, some people can go with the more verbose find('my-query', { polymorphic: true }) and others can have that as the default behaviour.
  • With Ember Engines, can one assume that all models are loaded? If all models aren't loaded, then one cannot reliably determine the model-hierarchy, so auto-discovery wouldn't work. Not sure if this would be a problem in practice or not, but could be worth keeping in mind.

@locks locks added the T-ember-data RFCs that impact the ember-data library label Sep 1, 2017
@wagenet

wagenet commented Jul 23, 2022

Copy link
Copy Markdown
Member

@runspired is this something you want to pursue?

@wagenet wagenet added the S-Proposed In the Proposed Stage label Dec 2, 2022
@runspired

Copy link
Copy Markdown
Contributor

I don't think we need this anymore. Requests and the cache are now agnostic to type, and the identifiers RFC allows users to configure multiple types being considered as part of one identity.

@runspired runspired closed this Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-Proposed In the Proposed Stage T-ember-data RFCs that impact the ember-data library

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants