HosipLan

Untitled

Oct 11th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. class PackageManifestGenerator extends Nette\Object
  2. {
  3.     private $db;
  4.     private $postMethod;
  5.     private $tablesGen;
  6.  
  7.     public function __construct($db, PostMethodProvider $postMethod, PHPExcel $tablesGen)
  8.     {
  9.         $this->db = $db;
  10.         $this->postMethod = $postMethod;
  11.         $this->tablesGen = $tablesGen;
  12.     }
  13.  
  14.     public function generate($from, $to)
  15.     {
  16.         $data = array();
  17.  
  18.         $packages = $this->db->table(...)->where($from, $to);
  19.         foreach ($packages as $package) {
  20.             $postMethod = $this->postMethod->get($packageId);
  21.             $row = array(
  22.                 ...,
  23.                 $package->senderName,
  24.                 ...
  25.             );
  26.  
  27.             $data[] = $row;
  28.         }
  29.        
  30.         // ...
  31.        
  32.         $xls = $this->tables->generate($data); // uz si nepamatuju to api
  33.         return new XlsResponse($xls);
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment