00001 <?php
00002
00012 class CSERDldapUser extends CSERDModelBase {
00014 public static $ATTRIBUTES = array(
00015 'firstName' => array(
00016 'type' => 'string',
00017 'default' => null
00018 ),
00019 'lastName' => array(
00020 'type' => 'string',
00021 'default' => null
00022 ),
00023 'email' => array(
00024 'nullable' => false,
00025 'type' => 'string'
00026 ),
00027 'userName' => array(
00028 'nullable' => false,
00029 'type' => 'string'
00030 ),
00031 'gecos' => array(
00032 'type' => 'string',
00033 'default' => null
00034 ),
00035 'password' => array(
00036 'type' => 'string',
00037 'default' => null
00038 ),
00039 'phone' => array(
00040 'type' => 'string',
00041 'default' => null
00042 ),
00043 'role' => array(
00044 'type' => 'string'
00045 )
00046 );
00047
00056 public function __construct($constraints = null) {
00057 parent::__construct();
00058
00059 $this->registerAttributes(self::$ATTRIBUTES);
00060 $this->registerTableName('ldapUser');
00061
00062 if($constraints !== null)
00063 $this->populate($constraints);
00064 }
00065
00077 public static function retrieve($constraints = array(), $checkOnly = false) {
00078 $list = self::getList($constraints, array(1), array(), $checkOnly);
00079 if(!$list || count($list) == 0)
00080 return $checkOnly ? false : null;
00081 else if($checkOnly)
00082 return $list > 0;
00083 else
00084 return $list[0];
00085 }
00086
00095 public static function exists($constraints = array()) {
00096 return self::retrieve($constraints, true);
00097 }
00098
00112 public static function getList($constraints = array(), $limit = array(), $order = array(), $count = false) {
00113 return parent::getListBase(self::getDBI(), $constraints, $limit, $order, $count, 'CSERDldapUser', true);
00114 }
00115
00125 public static function getAttributesStatic() {
00126 return self::$ATTRIBUTES;
00127 }
00128
00134 public static function getTableNameStatic() {
00135 return 'ldapUser';
00136 }
00137
00138 }
00139
00140 ?>