Changeset 512

Show
Ignore:
Timestamp:
04/14/07 13:17:47 (1 year ago)
Author:
mikey
Message:

fixed experiment examples

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/experiments/people/mikey/persistence/MyNewsArticle.php

    r256 r512  
    33 * class to test the persistence api 
    44 *  
    5  * @DBTable(name=news, type=InnoDB
     5 * @DBTable(name='news', type='InnoDB'
    66 */ 
    7 class MyNewsArticle extends stubBaseObject implements stubPersistable 
     7class MyNewsArticle extends stubAbstractPersistable 
    88{ 
    99    /** 
    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 
    1135     * 
    1236     * @var  int 
    1337     */ 
    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 
    4741     * 
    4842     * @var  int 
    4943     */ 
    50     protected $registered   = 0
    51     /** 
    52      * timestamp when article was last changed 
     44    protected $lastChanged  = null
     45    /** 
     46     * status of article 
    5347     * 
    5448     * @var  int 
    5549     */ 
    56     protected $lastChanged  = null; 
    57     /** 
    58      * status of article 
    59      * 
    60      * @var  int 
    61      */ 
    6250    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 
    7552    /** 
    7653     * returns the id of the news 
    7754     * 
    7855     * @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) 
    8057     */ 
    8158    public function getId() 
     
    8360        return $this->id; 
    8461    } 
    85      
     62 
    8663    /** 
    8764     * set the headline of the news article 
     
    9370        $this->headline = $headline; 
    9471    } 
    95      
     72 
    9673    /** 
    9774     * returns the headline of the news article 
    9875     * 
    9976     * @return  string 
    100      * @DBColumn(name=headline, type=varchar, size=255, isNullable=false, defaultValue=
     77     * @DBColumn(name='headline', type='varchar', size=255, isNullable=false, defaultValue=''
    10178     */ 
    10279    public function getHeadline() 
     
    10481        return $this->headline; 
    10582    } 
    106      
     83 
    10784    /** 
    10885     * set the name of the author of the news article 
     
    11491        $this->authorName = $authorName; 
    11592    } 
    116      
     93 
    11794    /** 
    11895     * returns the name of the author of the news article 
    11996     * 
    12097     * @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=''
    12299     */ 
    123100    public function getAuthorName() 
     
    125102        return $this->authorName; 
    126103    } 
    127      
     104 
    128105    /** 
    129106     * set the mail address of the author of the news article 
     
    135112        $this->authorMail = $authorMail; 
    136113    } 
    137      
     114 
    138115    /** 
    139116     * returns the mail address of the author of the news article 
    140117     * 
    141118     * @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=''
    143120     */ 
    144121    public function getAuthorMail() 
     
    146123        return $this->authorMail; 
    147124    } 
    148      
     125 
    149126    /** 
    150127     * set the content of the news article 
     
    156133        $this->content = $content; 
    157134    } 
    158      
     135 
    159136    /** 
    160137     * returns the content of the news article 
    161138     * 
    162139     * @return  string 
    163      * @DBColumn(name=content, type=text, isNullable=true) 
     140     * @DBColumn(name='content', type='text', isNullable=true) 
    164141     */ 
    165142    public function getContent() 
     
    167144        return $this->content; 
    168145    } 
    169      
     146 
    170147    /** 
    171148     * set the timestamp when article was created 
     
    177154        $this->registered = $registered; 
    178155    } 
    179      
     156 
    180157    /** 
    181158     * returns the timestamp when article was created 
    182159     * 
    183160     * @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) 
    185162     */ 
    186163    public function getRegistered() 
     
    188165        return $this->registered; 
    189166    } 
    190      
     167 
    191168    /** 
    192169     * set the timestamp when article was last changed 
     
    198175        $this->lastChanged = $lastChanged; 
    199176    } 
    200      
     177 
    201178    /** 
    202179     * returns the timestamp when article was last changed 
    203180     * 
    204181     * @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) 
    206183     */ 
    207184    public function getLastChanged() 
     
    209186        return $this->lastChanged; 
    210187    } 
    211      
     188 
    212189    /** 
    213190     * set the status of the article 
     
    219196        $this->status = $status; 
    220197    } 
    221      
     198 
    222199    /** 
    223200     * returns the status of the article 
    224201     * 
    225202     * @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) 
    227204     */ 
    228205    public function getStatus() 
     
    230207        return $this->status; 
    231208    } 
    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 
    259210    /** 
    260211     * returns a list of all instances with status $status 
  • trunk/experiments/people/mikey/persistence/createTable.php

    r324 r512  
    33require_once '../../../../src/main/php/net/stubbles/stubClassLoader.php'; 
    44stubClassLoader::load('net.stubbles.rdbms.rdbms', 
    5                       'net.stubbles.rdbms.persistence.stubPersistable', 
     5                      'net.stubbles.rdbms.persistence.stubAbstractPersistable', 
    66                      'net.stubbles.rdbms.persistence.creator.stubDatabaseCreator' 
    77); 
  • trunk/experiments/people/mikey/persistence/fetchEntry.php

    r256 r512  
    33require_once '../../../../src/main/php/net/stubbles/stubClassLoader.php'; 
    44stubClassLoader::load('net.stubbles.rdbms.rdbms', 
    5                       'net.stubbles.rdbms.persistence.stubPersistable', 
     5                      'net.stubbles.rdbms.persistence.stubAbstractPersistable', 
    66                      'net.stubbles.rdbms.persistence.finder.stubDatabaseFinder' 
    77); 
  • trunk/experiments/people/mikey/persistence/insertEntry.php

    r256 r512  
    33require_once '../../../../src/main/php/net/stubbles/stubClassLoader.php'; 
    44stubClassLoader::load('net.stubbles.rdbms.rdbms', 
    5                       'net.stubbles.rdbms.persistence.stubPersistable', 
     5                      'net.stubbles.rdbms.persistence.stubAbstractPersistable', 
    66                      'net.stubbles.rdbms.persistence.serializer.stubDatabaseSerializer' 
    77); 
  • trunk/experiments/people/mikey/persistence/listEntries.php

    r256 r512  
    44stubClassLoader::load('net.stubbles.rdbms.rdbms', 
    55                      'net.stubbles.rdbms.criteria.stubEqualCriterion', 
    6                       'net.stubbles.rdbms.persistence.stubPersistable', 
     6                      'net.stubbles.rdbms.persistence.stubAbstractPersistable', 
    77                      'net.stubbles.rdbms.persistence.finder.stubDatabaseFinder' 
    88); 
  • trunk/experiments/people/mikey/persistence/updateEntry.php

    r256 r512  
    33require_once '../../../../src/main/php/net/stubbles/stubClassLoader.php'; 
    44stubClassLoader::load('net.stubbles.rdbms.rdbms', 
    5                       'net.stubbles.rdbms.persistence.stubPersistable', 
     5                      'net.stubbles.rdbms.persistence.stubAbstractPersistable', 
    66                      'net.stubbles.rdbms.persistence.finder.stubDatabaseFinder', 
    77                      'net.stubbles.rdbms.persistence.serializer.stubDatabaseSerializer'