/** * Populate a Post object with Post_Taxonomy relationships. * * @param Post $post */ public function get_post_taxonomy_relationships(Post $post) { $query = $this->wpdb->prepare('SELECT * FROM ' . $this->get_table() . ' WHERE object_id = %d', $post->get_id()); foreach ($this->wpdb->get_results($query, ARRAY_A) as $relationship) { $taxonomy = $this->taxonomy_dao->find($relationship['term_taxonomy_id']); if ($taxonomy instanceof Taxonomy) { $post->add_post_taxonomy(new Post_Taxonomy($post, $taxonomy)); } } }