Changeset 512
- Timestamp:
- 04/14/07 13:17:47 (1 year ago)
- Files:
-
- trunk/experiments/people/mikey/persistence/MyNewsArticle.php (modified) (16 diffs)
- trunk/experiments/people/mikey/persistence/createTable.php (modified) (1 diff)
- trunk/experiments/people/mikey/persistence/fetchEntry.php (modified) (1 diff)
- trunk/experiments/people/mikey/persistence/insertEntry.php (modified) (1 diff)
- trunk/experiments/people/mikey/persistence/listEntries.php (modified) (1 diff)
- trunk/experiments/people/mikey/persistence/updateEntry.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/experiments/people/mikey/persistence/MyNewsArticle.php
r256 r512 3 3 * class to test the persistence api 4 4 * 5 * @DBTable(name= news, type=InnoDB)5 * @DBTable(name='news', type='InnoDB') 6 6 */ 7 class MyNewsArticle extends stub BaseObject implements stubPersistable7 class MyNewsArticle extends stubAbstractPersistable 8 8 { 9 9 /** 10 * id of the news 10 * headline of the news article 11 * 12 * @var string 13 */ 14 protected $headline = ''; 15 /** 16 * name of the author of the news article 17 * 18 * @var string 19 */ 20 protected $authorName = ''; 21 /** 22 * mail address of the author of the news article 23 * 24 * @var string 25 */ 26 protected $authorMail = ''; 27 /** 28 * content of the news article 29 * 30 * @var string 31 */ 32 protected $content = ''; 33 /** 34 * timestamp when article was created 11 35 * 12 36 * @var int 13 37 */ 14 protected $id = null; 15 /** 16 * switch whether news is stored persistent or not 17 * 18 * @var bool 19 */ 20 protected $isPersistent = false; 21 /** 22 * headline of the news article 23 * 24 * @var string 25 */ 26 protected $headline = ''; 27 /** 28 * name of the author of the news article 29 * 30 * @var string 31 */ 32 protected $authorName = ''; 33 /** 34 * mail address of the author of the news article 35 * 36 * @var string 37 */ 38 protected $authorMail = ''; 39 /** 40 * content of the news article 41 * 42 * @var string 43 */ 44 protected $content = ''; 45 /** 46 * timestamp when article was created 38 protected $registered = 0; 39 /** 40 * timestamp when article was last changed 47 41 * 48 42 * @var int 49 43 */ 50 protected $ registered = 0;51 /** 52 * timestamp when article was last changed44 protected $lastChanged = null; 45 /** 46 * status of article 53 47 * 54 48 * @var int 55 49 */ 56 protected $lastChanged = null;57 /**58 * status of article59 *60 * @var int61 */62 50 protected $status = null; 63 64 /** 65 * set the id of the persistable object 66 * 67 * @param int $id 68 * @see net.stubbles.rdbms.persistence.stubPersistable::setId() 69 */ 70 public function setId($id) 71 { 72 $this->id = $id; 73 } 74 51 75 52 /** 76 53 * returns the id of the news 77 54 * 78 55 * @return int 79 * @DBColumn(name= news_id, type=int, size=10, isUnsigned=true, isPrimaryKey=true)56 * @DBColumn(name='news_id', type='int', size=10, isUnsigned=true, isPrimaryKey=true) 80 57 */ 81 58 public function getId() … … 83 60 return $this->id; 84 61 } 85 62 86 63 /** 87 64 * set the headline of the news article … … 93 70 $this->headline = $headline; 94 71 } 95 72 96 73 /** 97 74 * returns the headline of the news article 98 75 * 99 76 * @return string 100 * @DBColumn(name= headline, type=varchar, size=255, isNullable=false, defaultValue=)77 * @DBColumn(name='headline', type='varchar', size=255, isNullable=false, defaultValue='') 101 78 */ 102 79 public function getHeadline() … … 104 81 return $this->headline; 105 82 } 106 83 107 84 /** 108 85 * set the name of the author of the news article … … 114 91 $this->authorName = $authorName; 115 92 } 116 93 117 94 /** 118 95 * returns the name of the author of the news article 119 96 * 120 97 * @return string 121 * @DBColumn(name= author_name, type=varchar, size=255, isNullable=false, defaultValue=)98 * @DBColumn(name='author_name', type='varchar', size=255, isNullable=false, defaultValue='') 122 99 */ 123 100 public function getAuthorName() … … 125 102 return $this->authorName; 126 103 } 127 104 128 105 /** 129 106 * set the mail address of the author of the news article … … 135 112 $this->authorMail = $authorMail; 136 113 } 137 114 138 115 /** 139 116 * returns the mail address of the author of the news article 140 117 * 141 118 * @return string 142 * @DBColumn(name= author_mail, type=varchar, size=255, isNullable=false, defaultValue=)119 * @DBColumn(name='author_mail', type='varchar', size=255, isNullable=false, defaultValue='') 143 120 */ 144 121 public function getAuthorMail() … … 146 123 return $this->authorMail; 147 124 } 148 125 149 126 /** 150 127 * set the content of the news article … … 156 133 $this->content = $content; 157 134 } 158 135 159 136 /** 160 137 * returns the content of the news article 161 138 * 162 139 * @return string 163 * @DBColumn(name= content, type=text, isNullable=true)140 * @DBColumn(name='content', type='text', isNullable=true) 164 141 */ 165 142 public function getContent() … … 167 144 return $this->content; 168 145 } 169 146 170 147 /** 171 148 * set the timestamp when article was created … … 177 154 $this->registered = $registered; 178 155 } 179 156 180 157 /** 181 158 * returns the timestamp when article was created 182 159 * 183 160 * @return int 184 * @DBColumn(name= registered, type=int, size=10, isUnsigned=true, defaultValue=0)161 * @DBColumn(name='registered', type='int', size=10, isUnsigned=true, defaultValue=0) 185 162 */ 186 163 public function getRegistered() … … 188 165 return $this->registered; 189 166 } 190 167 191 168 /** 192 169 * set the timestamp when article was last changed … … 198 175 $this->lastChanged = $lastChanged; 199 176 } 200 177 201 178 /** 202 179 * returns the timestamp when article was last changed 203 180 * 204 181 * @return int 205 * @DBColumn(name= last_changed, type=int, size=10, isUnsigned=true, isNullable=true)182 * @DBColumn(name='last_changed', type='int', size=10, isUnsigned=true, isNullable=true) 206 183 */ 207 184 public function getLastChanged() … … 209 186 return $this->lastChanged; 210 187 } 211 188 212 189 /** 213 190 * set the status of the article … … 219 196 $this->status = $status; 220 197 } 221 198 222 199 /** 223 200 * returns the status of the article 224 201 * 225 202 * @return int 226 * @DBColumn(name= status, type=enum, size='1'_'2'_'3'_'4'_'5', defaultValue=3, isKey=true)203 * @DBColumn(name='status', type='enum', size="'1','2','3','4','5'", defaultValue='3', isKey=true) 227 204 */ 228 205 public function getStatus() … … 230 207 return $this->status; 231 208 } 232 233 /** 234 * set whether the persistable object is persistent or not 235 * 236 * A persistable object should be set to isPersistent if its data 237 * was retrieved from a persistent store or if an unpersistent 238 * object was made persistent. 239 * 240 * @param bool $isPersistent 241 * @see net.stubbles.rdbms.persistence.stubPersistable::setPersistent() 242 */ 243 public function setPersistent($isPersistent) 244 { 245 $this->isPersistent = $isPersistent; 246 } 247 248 /** 249 * check whether the persistable object is persistent 250 * 251 * @return bool 252 * @see net.stubbles.rdbms.persistence.stubPersistable::isPersistent() 253 */ 254 public function isPersistent() 255 { 256 return $this->isPersistent; 257 } 258 209 259 210 /** 260 211 * returns a list of all instances with status $status trunk/experiments/people/mikey/persistence/createTable.php
r324 r512 3 3 require_once '../../../../src/main/php/net/stubbles/stubClassLoader.php'; 4 4 stubClassLoader::load('net.stubbles.rdbms.rdbms', 5 'net.stubbles.rdbms.persistence.stub Persistable',5 'net.stubbles.rdbms.persistence.stubAbstractPersistable', 6 6 'net.stubbles.rdbms.persistence.creator.stubDatabaseCreator' 7 7 ); trunk/experiments/people/mikey/persistence/fetchEntry.php
r256 r512 3 3 require_once '../../../../src/main/php/net/stubbles/stubClassLoader.php'; 4 4 stubClassLoader::load('net.stubbles.rdbms.rdbms', 5 'net.stubbles.rdbms.persistence.stub Persistable',5 'net.stubbles.rdbms.persistence.stubAbstractPersistable', 6 6 'net.stubbles.rdbms.persistence.finder.stubDatabaseFinder' 7 7 ); trunk/experiments/people/mikey/persistence/insertEntry.php
r256 r512 3 3 require_once '../../../../src/main/php/net/stubbles/stubClassLoader.php'; 4 4 stubClassLoader::load('net.stubbles.rdbms.rdbms', 5 'net.stubbles.rdbms.persistence.stub Persistable',5 'net.stubbles.rdbms.persistence.stubAbstractPersistable', 6 6 'net.stubbles.rdbms.persistence.serializer.stubDatabaseSerializer' 7 7 ); trunk/experiments/people/mikey/persistence/listEntries.php
r256 r512 4 4 stubClassLoader::load('net.stubbles.rdbms.rdbms', 5 5 'net.stubbles.rdbms.criteria.stubEqualCriterion', 6 'net.stubbles.rdbms.persistence.stub Persistable',6 'net.stubbles.rdbms.persistence.stubAbstractPersistable', 7 7 'net.stubbles.rdbms.persistence.finder.stubDatabaseFinder' 8 8 ); trunk/experiments/people/mikey/persistence/updateEntry.php
r256 r512 3 3 require_once '../../../../src/main/php/net/stubbles/stubClassLoader.php'; 4 4 stubClassLoader::load('net.stubbles.rdbms.rdbms', 5 'net.stubbles.rdbms.persistence.stub Persistable',5 'net.stubbles.rdbms.persistence.stubAbstractPersistable', 6 6 'net.stubbles.rdbms.persistence.finder.stubDatabaseFinder', 7 7 'net.stubbles.rdbms.persistence.serializer.stubDatabaseSerializer'
