Why are findQuery and findAll marked as @private?


#1

As the subject states: looking at the code for Ember data 11 Application adapter, although the instructions clearly state that any subclasses should implement findQuery and findAll among others, those two are documented as @private. It would seem that @protected is probably more fitting. Is there a reason for the current status?


#2

Not to mention we quite often use them publicly in routes… or at least I do!


#3

The find() method will call the correct method internally based on the arguments you pass it.

find('profile') // findAll
find('profile', 1) //findById
find('profile', { createDate: 32453423423}) // findQuery

Probably best that you just use find and let Ember Data call the correct thing. This just limits the surface area of the API.


#4

Thank you @chadhietala that is very enlightening, I hadn’t realized this was the case. However, this still has me wondering why those methods are marked as @private in the docs when they can (and must) be overridden in subclasses?

The question of why the store is calling private methods is another issue altogether, which falls into the category of ‘that’s our ember…’


#5

Well, in JS there is no such thing as real private or protected methods, so I imagine that they marked as private to make clear that you should never use them directly.