示例#1
0
 /**
  * @return Schema
  */
 protected static function defineSchema()
 {
     $schema = new Schema('pbj:gdbots:tests.pbj:fixtures:email-message:1-0-0', __CLASS__, [Fb::create('id', T\TimeUuidType::create())->required()->build(), Fb::create('from_name', T\StringType::create())->build(), Fb::create('from_email', T\StringType::create())->required()->format('email')->build(), Fb::create('subject', T\StringType::create())->withDefault(function (EmailMessage $message = null) {
         if (!$message) {
             return null;
         }
         return implode(',', $message->get('labels', [])) . ' test';
     })->build(), Fb::create('body', T\StringType::create())->build(), Fb::create('priority', T\IntEnumType::create())->required()->className('Gdbots\\Tests\\Pbj\\Fixtures\\Enum\\Priority')->withDefault(Priority::NORMAL)->build(), Fb::create('sent', T\BooleanType::create())->build(), Fb::create('date_sent', T\DateTimeType::create())->build(), Fb::create('microtime_sent', T\MicrotimeType::create())->build(), Fb::create('provider', T\StringEnumType::create())->className('Gdbots\\Tests\\Pbj\\Fixtures\\Enum\\Provider')->withDefault(Provider::GMAIL())->build(), Fb::create('labels', T\StringType::create())->format(Format::HASHTAG())->asASet()->build(), Fb::create('nested', T\MessageType::create())->className('Gdbots\\Tests\\Pbj\\Fixtures\\NestedMessage')->build(), Fb::create('enum_in_set', T\StringEnumType::create())->className('Gdbots\\Tests\\Pbj\\Fixtures\\Enum\\Provider')->asASet()->build(), Fb::create('enum_in_list', T\StringEnumType::create())->className('Gdbots\\Tests\\Pbj\\Fixtures\\Enum\\Provider')->asAList()->build(), Fb::create('any_of_message', T\MessageType::create())->className('Gdbots\\Pbj\\Message')->asAList()->build(), Fb::create('dynamic_fields', T\DynamicFieldType::create())->asAList()->build()]);
     MessageResolver::registerSchema($schema);
     return $schema;
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function getFields()
 {
     return [Fb::create('node_ref', T\MessageRefType::create())->build(), Fb::create('node_status', T\StringEnumType::create())->className('Gdbots\\Schemas\\Ncr\\Enum\\NodeStatus')->build(), Fb::create('new_slug', T\StringType::create())->format(Format::SLUG())->build(), Fb::create('old_slug', T\StringType::create())->format(Format::SLUG())->build()];
 }
示例#3
0
 /**
  * @return Schema
  */
 protected static function defineSchema()
 {
     return new Schema('pbj:eme:solicits:edge:submissions:1-0-0', __CLASS__, [Fb::create('multiplicity', T\StringEnumType::create())->withDefault(EdgeMultiplicity::ONE2MANY())->className('Gdbots\\Schemas\\Ncr\\Enum\\EdgeMultiplicity')->build()], [EdgeV1Mixin::create()]);
 }
示例#4
0
 /**
  * {@inheritdoc}
  */
 public function getFields()
 {
     return [Fb::create('from_ref', T\MessageRefType::create())->build(), Fb::create('to_ref', T\MessageRefType::create())->build(), Fb::create('multiplicity', T\StringEnumType::create())->withDefault(EdgeMultiplicity::MULTI())->className('Gdbots\\Schemas\\Ncr\\Enum\\EdgeMultiplicity')->overridable(true)->build(), Fb::create('created_at', T\MicrotimeType::create())->build()];
 }
示例#5
0
 /**
  * {@inheritdoc}
  */
 public function getFields()
 {
     return [Fb::create('_id', T\IdentifierType::create())->required()->withDefault(function () {
         return UuidIdentifier::generate();
     })->className('Gdbots\\Identifiers\\UuidIdentifier')->overridable(true)->build(), Fb::create('status', T\StringEnumType::create())->withDefault(NodeStatus::DRAFT())->className('Gdbots\\Schemas\\Ncr\\Enum\\NodeStatus')->build(), Fb::create('etag', T\StringType::create())->maxLength(100)->pattern('^[\\w\\.:-]+$')->build(), Fb::create('created_at', T\MicrotimeType::create())->build(), Fb::create('creator_ref', T\MessageRefType::create())->build(), Fb::create('updated_at', T\MicrotimeType::create())->useTypeDefault(false)->build(), Fb::create('updater_ref', T\MessageRefType::create())->build(), Fb::create('last_event_ref', T\MessageRefType::create())->build(), Fb::create('title', T\StringType::create())->build()];
 }