AnsPress_Query::append_ref_data( string $type, integer $ref_id, mixed $data )

Description #

Add reference data to obejcts.

Parameters #

  • $type
    string (Required) ids type.
  • $ref_id
    integer (Required) Reference ID.
  • $data
    mixed (Required) Reference data.

Source #

File: includes/class-query.php

	public function append_ref_data( $type, $ref_id, $data ) {
		if ( isset( $this->pos[ $type ] ) &&
			( 0 == $this->pos[ $type ][ $ref_id ] || ! empty( $this->pos[ $type ][ $ref_id ] ) ) // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
			) {
			$pos = $this->pos[ $type ][ $ref_id ];
			if ( is_array( $pos ) ) {
				foreach ( (array) $pos as $key ) {
					$this->objects[ $key ]->ref = $data;
				}
			} else {
				$this->objects[ $pos ]->ref = $data;
			}
		}
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment