Changeset 246

Show
Ignore:
Timestamp:
02/10/07 00:28:44 (2 years ago)
Author:
mikey
Message:

added setterMethod for DBColumn
added characterSet, collation and comment for DBTable
removed annotation target property (just using methods is complicated enough for the moment)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/rdbms/persistence/annotations/stubDBColumnAnnotation.php

    r242 r246  
    6666     */ 
    6767    protected $isKey        = false; 
     68    /** 
     69     * the name of the setter method to use for restoring the value from database 
     70     * 
     71     * @var  string 
     72     */ 
     73    protected $setterMethod = null; 
    6874     
    6975    /** 
     
    7480    public function getAnnotationTarget() 
    7581    { 
    76         return stubAnnotation::TARGET_PROPERTY + stubAnnotation::TARGET_METHOD; 
     82        return stubAnnotation::TARGET_METHOD; 
    7783    } 
    7884     
     
    252258        return (false == $this->isPrimaryKey && true == $this->isKey); 
    253259    } 
     260     
     261    /** 
     262     * set the name of the setter method 
     263     * 
     264     * @param  string  $setterMethod 
     265     */ 
     266    public function setSetterMethod($setterMethod) 
     267    { 
     268        $this->setterMethod = $setterMethod; 
     269    } 
     270     
     271    /** 
     272     * checks whether the name of the setter method is known 
     273     * 
     274     * @return  bool 
     275     */ 
     276    public function hasSetterMethod() 
     277    { 
     278        return (null !== $this->setterMethod); 
     279    } 
     280     
     281    /** 
     282     * returns the name of the setter method 
     283     * 
     284     * @return  string 
     285     */ 
     286    public function getSetterMethod() 
     287    { 
     288        return $this->setterMethod; 
     289    } 
    254290} 
    255291?> 
  • trunk/src/main/php/net/stubbles/rdbms/persistence/annotations/stubDBTableAnnotation.php

    r242 r246  
    3030     */ 
    3131    protected $type; 
     32    /** 
     33     * the character set to use for this table 
     34     * 
     35     * @var  string 
     36     */ 
     37    protected $characterSet = null; 
     38    /** 
     39     * the collation to use for this table 
     40     * 
     41     * @var  string 
     42     */ 
     43    protected $collation    = null; 
     44    /** 
     45     * an optional comment for this table 
     46     * 
     47     * @var  string 
     48     */ 
     49    protected $comment      = null; 
    3250     
    3351    /** 
     
    3856    public function getAnnotationTarget() 
    3957    { 
    40         return stubAnnotation::TARGET_CLASS + stubAnnotation::TARGET_PROPERTY + stubAnnotation::TARGET_METHOD; 
     58        return stubAnnotation::TARGET_CLASS + stubAnnotation::TARGET_METHOD; 
    4159    } 
    4260     
     
    6280     
    6381    /** 
    64      * sets the type of the column 
     82     * sets the type of the table 
    6583     * 
    6684     * @param  string  $type 
     
    7290 
    7391    /** 
    74      * returns the type of the column 
     92     * returns the type of the table 
    7593     * 
    7694     * @return  string 
     
    8098        return $this->type; 
    8199    } 
     100     
     101    /** 
     102     * sets the character set of the table 
     103     * 
     104     * @param  string  $characterSet 
     105     */ 
     106    public function setCharacterSet($characterSet) 
     107    { 
     108        $this->characterSet = $characterSet; 
     109    } 
     110     
     111    /** 
     112     * check if a character set is set 
     113     * 
     114     * @return  bool 
     115     */ 
     116    public function hasCharacterSet() 
     117    { 
     118        return (null !== $this->characterSet); 
     119    } 
     120     
     121    /** 
     122     * returns the character set of the table if set, else null 
     123     * 
     124     * @return  string 
     125     */ 
     126    public function getCharacterSet() 
     127    { 
     128        return $this->characterSet; 
     129    } 
     130     
     131    /** 
     132     * sets the collation of the table 
     133     * 
     134     * @param  string  $collation 
     135     */ 
     136    public function setCollation($collation) 
     137    { 
     138        $this->collation = $collation; 
     139    } 
     140     
     141    /** 
     142     * check if a collation is set 
     143     * 
     144     * @return  bool 
     145     */ 
     146    public function hasCollation() 
     147    { 
     148        return (null !== $this->collation); 
     149    } 
     150     
     151    /** 
     152     * returns the collation of the table if set, else null 
     153     * 
     154     * @return  string 
     155     */ 
     156    public function getCollation() 
     157    { 
     158        return $this->collation; 
     159    } 
     160     
     161    /** 
     162     * sets the comment of the table 
     163     * 
     164     * @param  string  $comment 
     165     */ 
     166    public function setComment($comment) 
     167    { 
     168        $this->comment = $comment; 
     169    } 
     170     
     171    /** 
     172     * check if a comment is set 
     173     * 
     174     * @return  bool 
     175     */ 
     176    public function hasComment() 
     177    { 
     178        return (null !== $this->comment); 
     179    } 
     180     
     181    /** 
     182     * returns the comment of the table if set, else null 
     183     * 
     184     * @return  string 
     185     */ 
     186    public function getComment() 
     187    { 
     188        return $this->comment; 
     189    } 
    82190} 
    83191?>