AnsPress_Notification_Query::prefetch()
Description #
Prefetch posts, comments and other data.
Source #
File: addons/free/notification/query.php
public function prefetch() { foreach ( (array) $this->objects as $key => $noti ) { if ( ! empty( $noti->noti_ref_id ) ) { $current_verb = $this->verb_args( $noti->noti_verb ); if ( in_array( $current_verb['ref_type'], [ 'question', 'answer', 'post' ], true ) ) { $this->add_prefetch_id( 'post', $noti->noti_ref_id, $key ); } if ( 'comment' === $current_verb['ref_type'] ) { $this->add_prefetch_id( 'comment', $noti->noti_ref_id, $key ); } if ( 'reputation' === $current_verb['ref_type'] ) { $this->add_prefetch_id( 'reputation', $noti->noti_ref_id, $key ); } } if ( ! empty( $noti->noti_actor ) ) { $this->add_prefetch_id( 'user', $noti->noti_actor ); } } $this->prefetch_posts(); $this->prefetch_comments(); $this->prefetch_actors(); $this->prefetch_reputations(); }
Expand full source code Collapse full source code View on GitHub: addons/free/notification/query.php:95
Add your comment