@@ -85,11 +85,13 @@ discard block |
||
| 85 | 85 | $class_name = $called_class->getShortName(); |
| 86 | 86 | |
| 87 | 87 | // try constants |
| 88 | - if (($table_name = $called_class->getConstant('TABLE_NAME')) !== false) |
|
| 89 | - return $table_name; |
|
| 88 | + if (($table_name = $called_class->getConstant('TABLE_NAME')) !== false) { |
|
| 89 | + return $table_name; |
|
| 90 | + } |
|
| 90 | 91 | |
| 91 | - if (defined($const_name = 'TABLE_' . strtoupper($class_name))) |
|
| 92 | - return constant($const_name); |
|
| 92 | + if (defined($const_name = 'TABLE_' . strtoupper($class_name))) { |
|
| 93 | + return constant($const_name); |
|
| 94 | + } |
|
| 93 | 95 | |
| 94 | 96 | // fallback to convention |
| 95 | 97 | return strtolower($class_name); |
@@ -106,8 +108,7 @@ discard block |
||
| 106 | 108 | if($this->isNew()){ |
| 107 | 109 | // $table_row = new Row($this, $model_data); |
| 108 | 110 | $table_row = new Row($this->schema, static::table(), $model_data); |
| 109 | - } |
|
| 110 | - else{ |
|
| 111 | + } else{ |
|
| 111 | 112 | $table_row = new Row($this->schema); |
| 112 | 113 | $table_row->load($model_data); |
| 113 | 114 | } |
@@ -168,8 +169,9 @@ discard block |
||
| 168 | 169 | else if (is_scalar($arg1) && count($table->primaryKeys()) === 1) { |
| 169 | 170 | $pk = current($table->primaryKeys())->name(); |
| 170 | 171 | $unique_identifiers = [$pk => $arg1]; |
| 171 | - } else |
|
| 172 | - throw new CruditesException('ARGUMENTS_ARE_NOT_ACTIONNABLE'); |
|
| 172 | + } else { |
|
| 173 | + throw new CruditesException('ARGUMENTS_ARE_NOT_ACTIONNABLE'); |
|
| 174 | + } |
|
| 173 | 175 | |
| 174 | 176 | |
| 175 | 177 | // Find the unique identifier(s) in the database. |