Advertisement
Guest User

Untitled

a guest
Oct 21st, 2015
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.84 KB | None | 0 0
  1. <?php
  2.  
  3. // Collection - http://pastebin.com/XbEs08gi
  4. // Entity - http://pastebin.com/51wfap1F
  5.  
  6. /**
  7.  * @return <WHAT TO WRITE HERE>
  8.  */
  9. function getEntitiesFromSomeRepository() {
  10.     // of course this will be some class method, not a function
  11. }
  12.  
  13. $entities = getEntitiesFromSomeRepository();
  14. $collection = new Collection($entities);
  15.  
  16. $collection-> // at this place IDE should suggest autocompletes for class \Collection methods/properties
  17.  
  18. foreach ($collection as $entity) {
  19.     $entity-> // and at this point IDE should suggest autocompletes for class \Entity methods/properties
  20. }
  21.  
  22. // please note, that entity is a base class for entities that will be returned, each of them will have some custom methods, for example
  23. // ClientEntity extends \Entity
  24. // will have a method getFullName() { return $this->first_name.' '.$this->last_name; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement