| @@ 501-518 (lines=18) @@ | ||
| 498 | * |
|
| 499 | * @return string|false method name if it exists |
|
| 500 | */ |
|
| 501 | public static function getMutator($property) |
|
| 502 | { |
|
| 503 | $class = get_called_class(); |
|
| 504 | ||
| 505 | $k = $class.':'.$property; |
|
| 506 | if (!array_key_exists($k, self::$mutators)) { |
|
| 507 | $inflector = Inflector::get(); |
|
| 508 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 509 | ||
| 510 | if (!method_exists($class, $method)) { |
|
| 511 | $method = false; |
|
| 512 | } |
|
| 513 | ||
| 514 | self::$mutators[$k] = $method; |
|
| 515 | } |
|
| 516 | ||
| 517 | return self::$mutators[$k]; |
|
| 518 | } |
|
| 519 | ||
| 520 | /** |
|
| 521 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 529-546 (lines=18) @@ | ||
| 526 | * |
|
| 527 | * @return string|false method name if it exists |
|
| 528 | */ |
|
| 529 | public static function getAccessor($property) |
|
| 530 | { |
|
| 531 | $class = get_called_class(); |
|
| 532 | ||
| 533 | $k = $class.':'.$property; |
|
| 534 | if (!array_key_exists($k, self::$accessors)) { |
|
| 535 | $inflector = Inflector::get(); |
|
| 536 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 537 | ||
| 538 | if (!method_exists($class, $method)) { |
|
| 539 | $method = false; |
|
| 540 | } |
|
| 541 | ||
| 542 | self::$accessors[$k] = $method; |
|
| 543 | } |
|
| 544 | ||
| 545 | return self::$accessors[$k]; |
|
| 546 | } |
|
| 547 | ||
| 548 | ///////////////////////////// |
|
| 549 | // CRUD Operations |
|