public static function getDocumentByExclusiveTag($tagId) { $docId = false; try { if (BackendService::loadTagsRelations()) { if ($_SESSION && array_key_exists('tagsRelations', $_SESSION) && array_key_exists($tagId, $_SESSION['tagsRelations'])) { $docId = $_SESSION['tagsRelations'][$tagId][0]; } } else { $c = new Criteria(); $c->add(TagPeer::TAG_ID, $tagId); $tag = TagPeer::doSelectOne($c); if ($tag) { $c = new Criteria(); $c->add(TagrelationPeer::TAG_ID, $tag->getId()); $tagRelation = TagrelationPeer::doSelectOne($c); if ($tagRelation) { $docId = $tagRelation->getId(); } } } if ($docId) { $document = self::getDocumentInstance($docId); return $document; } else { FileHelper::Log("Missing exclusive tag: {$tagId}", UtilsHelper::MSG_ERROR); /* if(substr($tagId, 0, 12) == "website_page" && $tagId != "website_page_404") { sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action')); }*/ return null; } } catch (Exception $e) { return null; } }