/** * @depends testConstruct */ public function testSetAndGetFieldType(SetMeta $meta) { $this->assertInstanceOf('Psc\\Data\\SetMeta', $meta->setFieldType('tiny', $sit = new SmallIntegerType())); $this->assertInstanceOf('Webforge\\Types\\Type', $type = $meta->getFieldType('tiny')); $this->assertSame($sit, $type); $this->assertInstanceOf('Psc\\Data\\SetMeta', $meta->setFieldType('seconddim.tiny', $sit2 = new SmallIntegerType())); $this->assertInstanceOf('Webforge\\Types\\Type', $type = $meta->getFieldType(array('seconddim', 'tiny'))); $this->assertSame($sit2, $type); }
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 setFieldType($field, $type) { $this->meta->setFieldType($field, $type); return $this; }