public function graph()
 {
     return parent::graph()->extend(['GraphObjectExpected'])->properties(['string' => Type::String()->bindTo(['str', 'alphanumeric'])->expected(['__string', 'string__', 'str_val']), 'integer' => Type::Integer()->bindTo(['int'])->expected(['__integer', '__int', 'int_val']), 'simpleCollection' => Type::Collection(GraphSimple::create())->bindTo(['simple_collection', 'simples'])->expected(['simpleData', 'simple_data', 'simple-data']), 'simple' => Type::Object(GraphSimple::create())->bindTo(['GraphSimple', 'simple-val', 'simple.nested'])->expected(['__simple', 'simple__', 'nested.simple'])]);
 }
Esempio n. 2
0
 public function graph()
 {
     return parent::graph()->extend(['User'])->properties(['age' => Type::Integer(), 'email' => Type::String(), 'loggedIn' => Type::Boolean(), 'location' => Type::Object(Location::create()), 'friends' => Type::Collection(Person::create())])->finalize(function (User $instance, $scenario, $data) {
         $instance->email .= '__appended_finalized_value';
     });
 }
 public function graph()
 {
     return Entity::graph(['GraphObjectList'])->properties(['assoc' => Type::FlatArray(), 'nest' => Type::Object(GraphObjectNest::create()), 'baseList' => Type::Collection(GraphObjectBase::create())]);
 }