public function graph() { return parent::graph()->extend(['GraphObjectChild'])->properties(['childValueStr' => Type::String()->expected(array('child_val_str', 'cvsrt')), 'childValueBool' => Type::Boolean()->expected(array('child_val_bool'))])->finalize(function ($instance, $scenario) { if ($scenario === 'test-finalize-map') { //when using map we are dealing with the same instance of the object and can use $this directly $this->childValueStr = $this->childValueStr . '__append_finalize_value'; //but is safer to change the $instance values instead $instance->aDouble = $instance->aDouble + 1.5; } }); }
public function graph() { return Entity::graph(['GraphObjectNestedData'])->properties(['_id' => Type::Integer()->bindTo(['id']), 'integer' => Type::Integer()->bindTo(['flatNest.integer']), 'array' => Type::FlatArray()->bindTo(['flatNest.array']), 'anotherInteger' => Type::Integer()->expected(['flatNest.nest.integer']), 'base' => Type::Object(GraphObjectBase::create())->expected(['objectNest.base']), 'child' => Type::Object(GraphObjectChild::create())->bindTo(['objectNest.nest.child']), 'aProperty' => Type::Integer()->bindTo(['preferedproperty'])]); }
public function graph() { return Entity::graph(['GraphObjectList'])->properties(['assoc' => Type::FlatArray(), 'nest' => Type::Object(GraphObjectNest::create()), 'baseList' => Type::Collection(GraphObjectBase::create())]); }
public function graph() { return Entity::graph(['GraphMixed'])->properties(['mixedStandard' => Type::Mixed(), 'mixedCustom' => Type::Mixed(new CustomAdapterTest()), 'mixedCustomProperties' => Type::Mixed(new CustomAdapterTest())->apply(['base' => Type::Object(GraphObjectBase::create())->bindTo(['objectNest.base']), 'simple' => Type::Object(GraphSimple::create()), 'mixedCustom', 'mixedCustom2' => 'nest.mixedCustom2'])]); }