Tribe__Tickets__REST__V1__Attendee_Repository::order_by( string $order_by, string $order = 'DESC' )

Overrides the base order_by method to map and convert some REST API specific criteria.


Parameters

$order_by

(string) (Required) The post field, custom field or alias key to order posts by.

$order

(string) (Optional) The order direction; optional; shortcut for the order method; defaults to DESC.

Default value: 'DESC'


Top ↑

Return

($this)


Top ↑

Source

File: src/Tribe/REST/V1/Attendee_Repository.php

	public function order_by( $order_by, $order = 'DESC' ) {
		$map = array(
			'date'      => 'date',
			'relevance' => 'relevance',
			'id'        => 'id',
			'include'   => 'meta_value_num',
			'title'     => 'title',
			'slug'      => 'name',
		);

		// if ( 'include' === $order_by ) {
			// @todo review when one meta key is unified
		// }

		$converted_order_by = Tribe__Utils__Array::get( $map, $order_by, false );

		if ( empty( $converted_order_by ) ) {
			return $this;
		}

		$this->decorated->order_by( $converted_order_by, $order );

		return $this;
	}