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