Skip to content

Commit

Permalink
Fixes for ticket #54 regarding Undefined Offset in a Table Annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisJordan committed Feb 4, 2009
1 parent e099dde commit 1372039
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Expand Up @@ -15,7 +15,11 @@ class DatabaseAnnotation extends ModelAnnotation {
public $source;

function init($array) {
$this->source = $array[0];
if(isset($array[0]) && count($array) == 1) {
$this->source = $array[0];
} else {
throw new RecessException('!Database annotation takes 1 parameter: name. Ex: !Database Default', get_defined_vars());
}
}

function massage(ModelDescriptor &$descriptor) {
Expand Down
Expand Up @@ -15,11 +15,17 @@ class TableAnnotation extends ModelAnnotation {
public $table;

function init($array) {
$this->table = $array[0];
if(isset($array[0]) && count($array) == 1) {
$this->table = $array[0];
} else {
throw new RecessException('!Table annotation takes 1 parameter: table name. Ex: !Table my_table', get_defined_vars());
}
}

function massage(ModelDescriptor &$descriptor) {
$descriptor->setTable($this->table);
if(isset($this->table)) {
$descriptor->setTable($this->table);
}
}
}
?>

0 comments on commit 1372039

Please sign in to comment.