00001 <?php
00002
00012 class SDRValueCache extends ModelBase {
00014 public static $ATTRIBUTES = array(
00015 'valueId' => array(
00016 'nullable' => false,
00017 'commit' => SModel2::COMMIT_CHANGED,
00018 'type' => 'int'
00019 ),
00020 'value' => array(
00021 'type' => 'string'
00022 )
00023 );
00024
00033 public function __construct($constraints = null) {
00034 parent::__construct();
00035
00036 $this->registerAttributes(self::$ATTRIBUTES);
00037 $this->registerTableName('SDRValueCache');
00038 $this->registerPrimaryKey('valueId');
00039
00040 if($constraints !== null)
00041 $this->populate($constraints);
00042 }
00043
00055 public static function retrieve($constraints = array(), $checkOnly = false) {
00056 $list = self::getList($constraints, array(1), array(), $checkOnly);
00057 if(!$list || count($list) == 0)
00058 return $checkOnly ? false : null;
00059 else if($checkOnly)
00060 return $list > 0;
00061 else
00062 return $list[0];
00063 }
00064
00073 public static function exists($constraints = array()) {
00074 return self::retrieve($constraints, true);
00075 }
00076
00090 public static function getList($constraints = array(), $limit = array(), $order = array(), $count = false) {
00091 return parent::getListBase(self::getDBI(), $constraints, $limit, $order, $count, 'SDRValueCache', true);
00092 }
00093
00103 public static function getAttributesStatic() {
00104 return self::$ATTRIBUTES;
00105 }
00106
00112 public static function getTableNameStatic() {
00113 return 'SDRValueCache';
00114 }
00115
00116 }
00117
00118 ?>