示例#1
0
 /**
  * {@inheritdoc}
  */
 public function getFields()
 {
     return [Fb::create('ts_ymdh', T\IntType::create())->build(), Fb::create('ts_ymd', T\IntType::create())->build(), Fb::create('ts_ym', T\MediumIntType::create())->build()];
 }
示例#2
0
 /**
  * @return Schema
  */
 protected static function defineSchema()
 {
     $schema = new Schema('pbj:gdbots:tests.pbj:fixtures:nested-message:1-0-0', __CLASS__, [Fb::create('test1', T\StringType::create())->build(), Fb::create('test2', T\IntType::create())->asASet()->build(), Fb::create('location', T\GeoPointType::create())->build(), Fb::create('refs', T\MessageRefType::create())->asASet()->build()]);
     MessageResolver::registerSchema($schema);
     return $schema;
 }
示例#3
0
 /**
  * @param string $kind
  *
  * @return Field
  */
 private static function createField($kind)
 {
     if (!isset(self::$fields[$kind])) {
         switch ($kind) {
             case DynamicFieldKind::STRING_VAL:
                 $type = StringType::create();
                 break;
             case DynamicFieldKind::TEXT_VAL:
                 $type = TextType::create();
                 break;
             case DynamicFieldKind::INT_VAL:
                 $type = IntType::create();
                 break;
             case DynamicFieldKind::BOOL_VAL:
                 $type = BooleanType::create();
                 break;
             case DynamicFieldKind::FLOAT_VAL:
                 $type = FloatType::create();
                 break;
             case DynamicFieldKind::DATE_VAL:
                 $type = DateType::create();
                 break;
             default:
                 throw new InvalidArgumentException(sprintf('DynamicField "%s" is not a valid type.', $kind));
         }
         self::$fields[$kind] = new Field($kind, $type, FieldRule::A_SINGLE_VALUE(), true);
     }
     return self::$fields[$kind];
 }