00001 <?php
00002
00012 class CSERDnotification extends CSERDModelBase {
00014 public static $ATTRIBUTES = array(
00015 'notificationId' => array(
00016 'nullable' => false,
00017 'commit' => SModel2::COMMIT_NEVER,
00018 'type' => 'int'
00019 ),
00020 'source' => array(
00021 'type' => 'int',
00022 'default' => null
00023 ),
00024 'target' => array(
00025 'type' => 'int',
00026 'default' => null
00027 ),
00028 'message' => array(
00029 'type' => 'string'
00030 ),
00031 'type' => array(
00032 'type' => 'int',
00033 'default' => null
00034 ),
00035 'reviewId' => array(
00036 'type' => 'int',
00037 'default' => null
00038 ),
00039 'timestamp' => array(
00040 'nullable' => false,
00041 'commit' => SModel2::COMMIT_CHANGED,
00042 'type' => 'time',
00043 'default' => ''
00044 ),
00045 'subject' => array(
00046 'type' => 'string',
00047 'default' => null
00048 )
00049 );
00050
00059 public function __construct($constraints = null) {
00060 parent::__construct();
00061
00062 $this->registerAttributes(self::$ATTRIBUTES);
00063 $this->registerTableName('notification');
00064 $this->registerPrimaryKey('notificationId', true);
00065
00066 if($constraints !== null)
00067 $this->populate($constraints);
00068 }
00069
00081 public static function retrieve($constraints = array(), $checkOnly = false) {
00082 $list = self::getList($constraints, array(1), array(), $checkOnly);
00083 if(!$list || count($list) == 0)
00084 return $checkOnly ? false : null;
00085 else if($checkOnly)
00086 return $list > 0;
00087 else
00088 return $list[0];
00089 }
00090
00099 public static function exists($constraints = array()) {
00100 return self::retrieve($constraints, true);
00101 }
00102
00116 public static function getList($constraints = array(), $limit = array(), $order = array(), $count = false) {
00117 return parent::getListBase(self::getDBI(), $constraints, $limit, $order, $count, 'CSERDnotification', true);
00118 }
00119
00129 public static function getAttributesStatic() {
00130 return self::$ATTRIBUTES;
00131 }
00132
00138 public static function getTableNameStatic() {
00139 return 'notification';
00140 }
00141
00142 }
00143
00144 ?>