Lithron.LDatabase
[ class tree: Lithron.LDatabase ] [ index: Lithron.LDatabase ] [ all elements ]

Source for file LCreoleRow.php

Documentation is available at LCreoleRow.php

  1. <?php
  2.  
  3. /**
  4. * LCreoleRow class file.
  5. *
  6. * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
  7. * @copyright 2005, diemeisterei GmbH. All rights reserved.
  8. * @author $Author: schmunk $
  9. * @version $Revision: 188 $ $Date: 2006-05-11 10:50:16 +0200 (Do, 11 Mai 2006) $
  10. * @package Lithron.LDatabase
  11. * @subpackage Support
  12. */
  13.  
  14. /**
  15. * A propel-a-like object for consistent code. This object is read-only!
  16. * Note: Use propel when editing
  17. *
  18. * @package Lithron.LDatabase
  19. * @subpackage Support
  20. */
  21. class LCreoleRow
  22. {
  23. private $_row;
  24.  
  25. /**
  26. * Initializes variables
  27. */
  28. function __construct($row)
  29. {
  30. $this->_row = $row;
  31. }
  32.  
  33. /**
  34. * Magic getter function
  35. */
  36. function __get($value)
  37. {
  38. if (isset ($this->_row[$value]))
  39. {
  40. $return = $this->_row[$value];
  41. } else
  42. {
  43. $eval = "return \$this->get".$value."();";
  44. $return = eval ($eval);
  45. }
  46. return $return;
  47. }
  48. /**
  49. * Simulates propel getter functions
  50. */
  51. function __call($func, $param)
  52. {
  53. if (substr($func, 0, 3) == "get")
  54. {
  55. $name = substr($func, 3);
  56. $key = strtolower($name[0]);
  57. for ($c = 1; $c < strlen($name); $c ++)
  58. {
  59. $char = $name[$c];
  60. if ((strcmp(strtoupper($char), $char) == 0 && !is_numeric($char)) ? true : false)
  61. $key .= "_".strtolower($char);
  62. else
  63. $key .= strtolower($char);
  64.  
  65. }
  66. #echo "OK($key)";
  67. $return = $this->_row[$key];
  68. }
  69. return $return;
  70. }
  71.  
  72. }
  73. ?>

Documentation generated on Tue, 20 Jun 2006 05:15:04 +0200 by phpDocumentor 1.3.0RC4