Skip to content

Instantly share code, notes, and snippets.

@halfvector
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halfvector/9732963 to your computer and use it in GitHub Desktop.
Save halfvector/9732963 to your computer and use it in GitHub Desktop.
playing various form-gathering syntaxes
$data = $this->getRequirements([
'description' => ['type' => 'markdown', 'minLength' => 3, 'persistent' => true],
'title' => ['type' => 'string', 'minLength' => 3, 'persistent' => true],
'action' => ['type' => 'string', 'minLength' => 3],
'suggestionId' => ['type' => 'int'],
'reason' => ['type' => 'string', 'minLength' => 3, 'optional' => true, 'default' => ""],
'tags' => ['type' => 'array', 'optional' => true],
'attachments' => ['type' => 'file', 'optional' => true],
'keepAttachments' => ['type' => 'array', 'optional' => true]
]);
$data = $this->gather()
->keepAttachments->asArray()
->title->isRequired()->asString()
->description->isRequired()->asMarkdown()
->attachments->asFileArray()
->suggestionId->isRequired()->asInt()
->action->asString()
->reason->asString()
->tags->asArray()
->asObject();
$data = $this->gather()
->required()
->title->asString()
->description->asMarkdown()
->suggestionId->asInt()
->action->asString()
->optional()
->keepAttachments->asIntArray()
->attachments->asFileArray()
->reason->asString()
->tags->asArrayFromString()
->asObject();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment