| @@ 543-560 (lines=18) @@ | ||
| 540 | * |
|
| 541 | * @return string|false method name if it exists |
|
| 542 | */ |
|
| 543 | public static function getMutator($property) |
|
| 544 | { |
|
| 545 | $class = get_called_class(); |
|
| 546 | ||
| 547 | $k = $class.':'.$property; |
|
| 548 | if (!array_key_exists($k, self::$mutators)) { |
|
| 549 | $inflector = Inflector::get(); |
|
| 550 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 551 | ||
| 552 | if (!method_exists($class, $method)) { |
|
| 553 | $method = false; |
|
| 554 | } |
|
| 555 | ||
| 556 | self::$mutators[$k] = $method; |
|
| 557 | } |
|
| 558 | ||
| 559 | return self::$mutators[$k]; |
|
| 560 | } |
|
| 561 | ||
| 562 | /** |
|
| 563 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 571-588 (lines=18) @@ | ||
| 568 | * |
|
| 569 | * @return string|false method name if it exists |
|
| 570 | */ |
|
| 571 | public static function getAccessor($property) |
|
| 572 | { |
|
| 573 | $class = get_called_class(); |
|
| 574 | ||
| 575 | $k = $class.':'.$property; |
|
| 576 | if (!array_key_exists($k, self::$accessors)) { |
|
| 577 | $inflector = Inflector::get(); |
|
| 578 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 579 | ||
| 580 | if (!method_exists($class, $method)) { |
|
| 581 | $method = false; |
|
| 582 | } |
|
| 583 | ||
| 584 | self::$accessors[$k] = $method; |
|
| 585 | } |
|
| 586 | ||
| 587 | return self::$accessors[$k]; |
|
| 588 | } |
|
| 589 | ||
| 590 | ///////////////////////////// |
|
| 591 | // CRUD Operations |
|