Advertisement
Guest User

zf2 hydrator classMethods extract

a guest
Jan 26th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <?php
  2.  
  3. class Weather {
  4.     private $time;
  5.     private $rain;
  6.  
  7.     function setTime(\DateTime $time) {
  8.         $this->time = $time;
  9.     }
  10.  
  11.     function getTime() {
  12.         return $this->time;
  13.         }
  14.  
  15.     function setRain(Rain $rain) {
  16.         $this->rain = $rain;
  17.     }
  18.  
  19.     function getRain() {
  20.         return $rain;
  21.     }
  22. }
  23.  
  24.  
  25. class Rain {
  26.     private $description;
  27.     function setDescription($description) {
  28.         $this->description = $description;
  29.     }
  30.  
  31.     function getDescription() {
  32.         return $this->desc;
  33.     }
  34. }
  35.  
  36.  
  37. /**
  38. Should return:
  39.  object (Weather)
  40.     time
  41.         - timestamp = "2601024202422"
  42.     rain
  43.         - description = string "Testing"
  44.  
  45. Instead it returns:
  46.  object (Weather)
  47.     time
  48.         - timestamp = "2601024202422"
  49.     rain {}
  50. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement