public function graph()
 {
     return parent::graph()->extend(['GraphObjectGrandChildWithCallbacks'])->properties(['childValueStr' => Type::String()->handler(function ($data, $name, $scenario) {
         if ($scenario === self::$override_scenario) {
             return $scenario . $name . $data;
         }
         return null;
     })->expected(array('child_val_str'))]);
 }
 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 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;
         }
     });
 }
예제 #4
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(['GraphObjectNest'])->properties(['child' => Type::Object(GraphObjectChild::create()), 'ownProperty' => Type::String()]);
 }
 public function graph()
 {
     return Entity::graph(['GraphObjectStep'])->properties(['nested' => Type::Object(GraphObjectNest::create()), 'child' => Type::Object(GraphObjectChild::create()), 'list' => Type::Object(GraphObjectList::create()), 'property' => Type::String()->expected(array('someProperty')), 'anotherProperty' => Type::Integer()->expected(array('someOtherProperty'))]);
 }
 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'])]);
 }
예제 #8
0
 public function graph()
 {
     return Entity::graph(['GraphSimple'])->properties(['simpleInteger' => Type::Integer()->bindTo(['simple-integer', 'simple_integer'])->expected(['simpleInt', 'simple-int']), 'simpleString' => Type::String()->bindTo(['simple-string', 'simple_string'])->expected(['simpleString', 'simple-str']), 'simpleMixed' => Type::Mixed()->bindTo(['simple-mixed'])->expected(['mixed-simple'])]);
 }
예제 #9
0
 /**
  * @return Entity
  */
 public function graph()
 {
     return Entity::graph(['Person'])->properties(['id' => Type::Integer(), 'name' => Type::String(), 'gender' => Type::String()]);
 }
 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())]);
 }
예제 #12
0
 public function graph()
 {
     return Entity::graph(['Point'])->properties(['lat' => Type::Double()->expected(array('latitude')), 'lng' => Type::Double()->expected(array('longitude'))]);
 }
예제 #13
0
 public function graph()
 {
     return Entity::graph(['Location'])->properties(['point' => Type::Object(Point::create()), 'city' => Type::String(), 'country' => Type::String(), 'address' => Type::String()]);
 }
예제 #14
0
 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'])]);
 }