Example #1
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testGetDataForInvalidFieldStringException()
 {
     $titel = KVDdom_Util_Helper::getDataForFieldString(new KVDdom_SimpleTestDomainObject(1, 'Van Daele, Koen'), "getTi tel.getD ta");
 }
 /**
  * transform
  *
  * @return string
  */
 public function transform()
 {
     $csv = fopen('php://temp', 'r+');
     $maxRelicten = $this->config['max'];
     if ($this->coll->count() > $this->config['max']) {
         fputcsv($csv, array($this->config['max_error']));
     }
     $counter = 0;
     fputcsv($csv, array_keys($this->config['fields']));
     //$array = iterator_to_array($this->coll);
     foreach ($this->coll as $node) {
         $counter++;
         if ($counter > $this->config['max']) {
             break;
         }
         $fieldValues = array();
         foreach ($this->config['fields'] as $key => $value) {
             $var = KVDdom_Util_Helper::getDataForFieldString($node, $value);
             $fieldValues[] = $var;
         }
         fputcsv($csv, $fieldValues);
     }
     rewind($csv);
     $output = stream_get_contents($csv);
     $output = "" . $output;
     return $output;
 }