Archived
1
0
Fork 0
This repository has been archived on 2026-05-10. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
fiktivkod/application/models/Tag.php
2011-02-26 14:04:06 +01:00

23 lines
No EOL
638 B
PHP

<?php
class Mapper_Tag extends Fiktiv_Model_Mapper_DbTableAbstract
{
public function findByBlogPost($id)
{
$postHasTagsTable = new Table_PosthasTag();
$rows = $postHasTagsTable->getAdapter()->select()
->from('Post_has_Tag',array())
->join('Tag', 'Tag.id = Post_has_Tag.tagId', array('id', 'name'))
->where('Post_has_Tag.postId = ?', $id)
->query()->fetchAll();
$tags = array();
foreach ($rows as $row) {
$tags[$row['id']] = $row['name'];
}
return $tags;
}
}