| @@ 509-526 (lines=18) @@ | ||
| 506 | * |
|
| 507 | * @return string|false method name if it exists |
|
| 508 | */ |
|
| 509 | public static function getMutator($property) |
|
| 510 | { |
|
| 511 | $class = get_called_class(); |
|
| 512 | ||
| 513 | $k = $class.':'.$property; |
|
| 514 | if (!array_key_exists($k, self::$mutators)) { |
|
| 515 | $inflector = Inflector::get(); |
|
| 516 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 517 | ||
| 518 | if (!method_exists($class, $method)) { |
|
| 519 | $method = false; |
|
| 520 | } |
|
| 521 | ||
| 522 | self::$mutators[$k] = $method; |
|
| 523 | } |
|
| 524 | ||
| 525 | return self::$mutators[$k]; |
|
| 526 | } |
|
| 527 | ||
| 528 | /** |
|
| 529 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 537-554 (lines=18) @@ | ||
| 534 | * |
|
| 535 | * @return string|false method name if it exists |
|
| 536 | */ |
|
| 537 | public static function getAccessor($property) |
|
| 538 | { |
|
| 539 | $class = get_called_class(); |
|
| 540 | ||
| 541 | $k = $class.':'.$property; |
|
| 542 | if (!array_key_exists($k, self::$accessors)) { |
|
| 543 | $inflector = Inflector::get(); |
|
| 544 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 545 | ||
| 546 | if (!method_exists($class, $method)) { |
|
| 547 | $method = false; |
|
| 548 | } |
|
| 549 | ||
| 550 | self::$accessors[$k] = $method; |
|
| 551 | } |
|
| 552 | ||
| 553 | return self::$accessors[$k]; |
|
| 554 | } |
|
| 555 | ||
| 556 | ///////////////////////////// |
|
| 557 | // CRUD Operations |
|