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); }
public function testEmptyCollectionExportAsArray() { $objectExporter = new ObjectExporter(); $collection = new \Psc\Data\ArrayCollection(array()); $this->assertEquals(array(), $objectExporter->walk($collection, $this->createType('Collection<String>'))); }