The QueriableEntity trait allows for more object-oriented database queries by adding a layer of abstraction with WP_Query.


    trait QueriableEntityTrait {







    • wrapInEntities() — Wraps the resultset into entities of the current object type.


    • byAuthorID() — Adds a 'author' condition to the current query.
    • byMenuOrder()
    • byName()
    • byPlublication()
    • byRecency()
    • count() — Fetches the number of results the current queries returned.
    • countTotal() — Returns the total number of entities of the current type.
    • date() — Applies a date query to the querier.
    • direction() — Defines the direction on which the orderby() field will be sorted.
    • fetch() — Executes the query and resets it anew.
    • findAll() — Returns all the possible entities and ends the query.
    • findById() — Finds a model entity by it's ID.
    • first() — Fetches the first element matching the current query and resets it anew.
    • getQueryAdapter() — Return an object inheriting from Query on which requests will be ran. Inheriting classes can modify this to suit their needs.
    • limit() — Sets the maximum number of results the current query may return.
    • listing() — Executes the query and resets it anew.
    • offset() — Sets the starting offset of the current queries result set.
    • orWhere() — Allows the branching of different conditions in the same Wordpress query.
    • orderby() — Defines fields on which to order the current query.
    • paginate() — Paginates the current query. Must be called before the result set has been generated.
    • published()
    • query() — Starts a wrapped wp_query pattern object. Used to chain parameters It resets the query.
    • repo() — Returns an instantiated QueriableEntity to access the repository.
    • resetCurrentQuery() — Resets (forgets) the active query.
    • status() — Shorthand for setting conditions on the post_status column.
    • where() — The default catch all wrapper for WP_Query parameters.