<?php

class Post extends Fiktiv_Model_Row_Abstract
{
    protected $_tags = null;


    public function getPubDate()
    {
        return new Fiktiv_Date($this->pubDate);
    }

    public function hasTags()
    {
        if (null === $this->_tags) {
            $this->_tags = $this->getTags();
        }

        return (0 !== $this->_tags->count());
    }

    public function getTags()
    {
        // Quickie!
        if (null !== $this->_tags) {
            return $this->_tags;
        }

        return $this->findManyToManyRowset('ModelTag', 'ModelPostTag');
    }

    public function getAuthor()
    {
        return $this->findDependentRowset('ModelUser')->current();
    }
}
