コード例 #1
0
ファイル: Pluggable.php プロジェクト: demental/m
 /**
  * Use ObjectRegistry
  */
 public function getLink($row, $table = null, $link = false)
 {
     //    return parent::getLink($row,$table,$link);
     if ($table === null) {
         $links = $this->links();
         if (is_array($links)) {
             if ($links[$row]) {
                 list($table, $link) = explode(':', $links[$row]);
                 if ($p = strpos($row, ".")) {
                     $row = substr($row, 0, $p);
                 }
                 return $this->getLink($row, $table, $link);
             }
             // $this->raiseError(
             //     "getLink: $row is not defined as a link (normally this is ok)",
             //     DB_DATAOBJECT_ERROR_NODATA);
             $r = false;
             return $r;
             // technically a possible error condition?
         }
         // use the old _ method - this shouldnt happen if called via getLinks()
         if (!($p = strpos($row, '_'))) {
             $r = null;
             return $r;
         }
         $table = substr($row, 0, $p);
         return $this->getLink($row, $table);
     }
     if (!isset($this->{$row})) {
         // $this->raiseError("getLink: row not set $row", DB_DATAOBJECT_ERROR_NODATA);
         return false;
     }
     if ($obj = DB_DataObject_Pluggable::retreiveFromRegistry($table, $this->{$row})) {
         return $obj;
     }
     $obj = parent::getLink($row, $table, $link);
     if (is_object($obj)) {
         DB_DataObject_Pluggable::storeToRegistry($obj);
     }
     return $obj;
 }
コード例 #2
0
ファイル: db.php プロジェクト: demental/m
 protected static function _getTagFromTag($tag)
 {
     if (!is_a($tag, 'DataObjects_Tag')) {
         $t = DB_DataObject_Pluggable::retreiveFromRegistry('tag', 'strip', $tag);
         if ($t) {
             $tag = $t;
         } else {
             $t = DB_DataObject::factory('tag');
             $t->strip = $tag;
             if (!$t->find(true)) {
                 return false;
             }
             $tag = $t;
             DB_DataObject_Pluggable::storeToRegistry($tag);
         }
     }
     return $tag;
 }