AnsPress_Query::append_ref_data( string $type, integer $ref_id, mixed $data )
Description #
Add reference data to obejcts.
Parameters #
- $typestring (Required) ids type.
- $ref_idinteger (Required) Reference ID.
- $datamixed (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;
}
}
}
Expand full source code Collapse full source code View on GitHub: includes/class-query.php:303
Add your comment