|
@@ 397-405 (lines=9) @@
|
| 394 |
|
* @param string the table name |
| 395 |
|
* @return string the table name |
| 396 |
|
*/ |
| 397 |
|
public function tableize($class_name) |
| 398 |
|
{ |
| 399 |
|
$class_name = $this->denamespace($class_name); |
| 400 |
|
if (strncasecmp($class_name, 'Model_', 6) === 0) |
| 401 |
|
{ |
| 402 |
|
$class_name = substr($class_name, 6); |
| 403 |
|
} |
| 404 |
|
return $this->str->lower($this->pluralize($this->underscore($class_name))); |
| 405 |
|
} |
| 406 |
|
|
| 407 |
|
/** |
| 408 |
|
* Takes an underscored classname and uppercases all letters after the underscores. |
|
@@ 439-447 (lines=9) @@
|
| 436 |
|
* @param bool $use_underscore whether to use an underscore or not |
| 437 |
|
* @return string the foreign key |
| 438 |
|
*/ |
| 439 |
|
public function foreignKey($class_name, $use_underscore = true) |
| 440 |
|
{ |
| 441 |
|
$class_name = $this->denamespace($this->str->lower($class_name)); |
| 442 |
|
if (strncasecmp($class_name, 'Model_', 6) === 0) |
| 443 |
|
{ |
| 444 |
|
$class_name = substr($class_name, 6); |
| 445 |
|
} |
| 446 |
|
return $this->underscore($this->demodulize($class_name)).($use_underscore ? "_id" : "id"); |
| 447 |
|
} |
| 448 |
|
|
| 449 |
|
/** |
| 450 |
|
* Checks if the given word has a plural version. |