<?php

/**
 * Subclass for representing a row from the 'tblblogcategoryentry' table.
 *
 *
 *
 * @package lib.model
 */
class Tblblogcategoryentry extends BaseTblblogcategoryentry
{
  protected $ceObj = null;
  public function getObject() {
    if ($this->ceObj == null) $this->ceObj = new catentryBase($this);
    return $this->ceObj;
  }

  public function getCeThumbnail() {
    $r = parent::getCeThumbnail();
    if ($r != null) return $r;

    switch ($this->getCeType()) {
      case 1:
        $doc = $this->getTbldocument();
        return $doc->updateBlogCategoryEntryPath();
      case 0:
      case -1:
      case -2:
      case -3:
        $pre = $this->getTblpresentation();
        return $pre->updateBlogCategoryEntryPath();
    }
  }

  public function getCeTitle() {
    $title = parent::getCeTitle();
    if ($title === null) {
      $tblblogentry = $this->getTblblogentry();
      $title = $tblblogentry->getEntryTitle();
      $this->setCeTitle($title? $title: '');
      $this->save();
    }
    return $title;
  }

  public function getCeFiletype() {
    $r = parent::getCeFiletype();
    if ($r === null) {
      $r = $this->getTblblogentry()->getLinkObject()->getFileType();
      $this->setCeFiletype($r);
      $this->save();
    }
    return $r;
  }
}
