/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
-
+ function loadOrCreate($dom)
+ {
+ // should we validate domain?
+ static $cache = array();
+ if (isset($cache[$dom])) {
+ return $cache[$dom];
+ }
+
+ $cd = DB_DataObject::Factory($this->tableName());
+ if ($cd->get('domain', $dom)) {
+ $cache[$dom] = $cd;
+ return $cd;
+ }
+ $cd->domain = $dom;
+ $cd->insert();
+ $cache[$dom] = $cd;
+ return $cd;
+ }
}