ListingsMedia.php 936 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. *
  4. * PHP Pro Bid $Id$ J+WpUccI8EfmMR4qFBWatlZ2WpQN1bJZzHI61BMnZZ0=
  5. *
  6. * @link http://www.phpprobid.com
  7. * @copyright Copyright (c) 2014 Online Ventures Software LTD & CodeCube SRL
  8. * @license http://www.phpprobid.com/license Commercial License
  9. *
  10. * @version 7.0
  11. */
  12. /**
  13. * listings media table rowset class
  14. */
  15. namespace Ppb\Db\Table\Rowset;
  16. class ListingsMedia extends AbstractRowset
  17. {
  18. /**
  19. *
  20. * row object class
  21. *
  22. * @var string
  23. */
  24. protected $_rowClass = '\Ppb\Db\Table\Row\ListingMedia';
  25. public function getFormattedData()
  26. {
  27. $data = array();
  28. $types = array();
  29. foreach ($this->_data as $row) {
  30. $mediaType = $row['type'];
  31. if (!in_array($mediaType, $types)) {
  32. array_push($types, $mediaType);
  33. }
  34. $data[$mediaType][] = $row['value'];
  35. }
  36. return $data;
  37. }
  38. }