Make WordPress Core

Opened 8 years ago

Last modified 20 months ago

#37463 new enhancement

Abstract Query Class

Reported by: spacedmonkey's profile spacedmonkey Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Query Keywords: has-patch
Focuses: Cc:

Description

All of the query classes WP_Comment_Query, WP_Network_Query, WP_Site_Query, WP_Term_Query and WP_User_Query are based on WP_Query class. For that reason they have a lot of similar methods and variables. As all the classes basically do the same thing, we can use an abstract class, so all related methods and variables are on the abstract class. If all query classes extend this abstract class, we can keep structure and consistency. It would also mean, for example, we could just add filters and actions in the abstract class and these would filter down.

Attachments (1)

37463.diff (23.2 KB) - added by spacedmonkey 8 years ago.

Download all attachments as: .zip

Change History (5)

@spacedmonkey
8 years ago

#2 @DrewAPicture
8 years ago

  • Keywords has-patch added

@spacedmonkey Don't forget to add the has-patch keyboard when you add patches to tickets. Attachments don't trigger notifications :-)

#3 @PieWP
7 years ago

Think this is the beginning of something great, would love to some see constancy between the query classes.

If we can fix the following can we maybe set an actual version and maybe assign an owner of the ticket?

  • Create unit tests
  • Extend for WP_Term_Query
  • Check backward compatibility
  • Extends WP_Object_Query some more (WP_Query has some great features which can be made generic, and I think I saw the mention either in slack or some other tickets of making the meta_query usage available for other Query-classes)
  • Align with coding standards (think bracket usage is of somewhere)
  • Align with latest changes/developments (last patch was 17 months old)

More than willing to spend some time on this and creating a patch containing the points stated above if a core/lead developer can confirm wether the ticket/idea is actually desired.

#4 @spacedmonkey
20 months ago

  • Focuses performance removed
Note: See TracTickets for help on using tickets.