Example #1
0
 public function export()
 {
     $meta = new SetMeta();
     foreach ($this->getSetMeta()->getTypes() as $property => $type) {
         // @TODO schön wäre eigentlich auf ebene 2 immer nur "entity:id" zu exportieren
         // das müsste dann alle relevanten daten für die response haben
         if ($type instanceof EntityType || $type instanceof PersistentCollectionType) {
             continue;
         }
         $meta->setFieldType($property, $type);
     }
     $set = new Set(array(), $meta);
     foreach ($set->getKeys() as $property) {
         $set->set($property, $this->callGetter($property));
     }
     $exporter = new ObjectExporter();
     return $exporter->walkWalkable($set);
 }
Example #2
0
 public function testEmptyCollectionExportAsArray()
 {
     $objectExporter = new ObjectExporter();
     $collection = new \Psc\Data\ArrayCollection(array());
     $this->assertEquals(array(), $objectExporter->walk($collection, $this->createType('Collection<String>')));
 }