Last active
August 29, 2015 13:57
-
-
Save halfvector/9732963 to your computer and use it in GitHub Desktop.
playing various form-gathering syntaxes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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