/** * Executes create<Entity> methods **/ public function __call($method, $args) { if (preg_match('/create(\\w+)/', $method, $match)) { return $this->_mapper->createEntity(strtolower($match[1]), $args[0], $args[1]); } else { throw new Exception("Unknown method `{$method}'"); } }
/** * Returns true when last visible(!) cdate less one week * * @return boolean */ public function hasNewChildren() { if (isNull($obEntity = iterFirst($this->_mapper->getList('descendent_id')->filter('ancestor_id = ?', $this->id)->sort('cdate', 'DESC')->limit(1)))) { return FALSE; } return time() - strtotime($obEntity->cdate) <= C('forum.topic-alive-duration') ? TRUE : FALSE; }