public function graph() { return Entity::graph(['GraphObjectBase'])->properties(['aString' => Type::String(), 'anInteger' => Type::Integer()->expected(array('integer_val')), 'aBoolean' => Type::Boolean(), 'flatArray' => Type::FlatArray(), 'aDouble' => Type::Double()->defaultVal(20.0)])->finalize(function (GraphObjectBase $instance, $scenario) { if ($scenario === 'test-finalize-inject') { $instance->aString = 'thisisthefinalizedstring'; $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())]); }