Пример #1
0
 public function keyProvider()
 {
     return [[NativeKey::database(), 'foo', '{"match":{"databox_name": "foo"}}'], [NativeKey::collection(), 'bar', '{"match":{"collection_name": "bar"}}'], [NativeKey::mediaType(), 'baz', '{"match":{"type": "baz"}}'], [NativeKey::recordIdentifier(), 'qux', '{"match":{"record_id": "qux"}}']];
 }
Пример #2
0
 private function visitNativeKeyNode(TreeNode $node)
 {
     $this->assertChildrenCount($node, 1);
     $type = $node->getChild(0)->getValue()['token'];
     switch ($type) {
         case NodeTypes::TOKEN_DATABASE:
             return AST\KeyValue\NativeKey::database();
         case NodeTypes::TOKEN_COLLECTION:
             return AST\KeyValue\NativeKey::collection();
         case NodeTypes::TOKEN_MEDIA_TYPE:
             return AST\KeyValue\NativeKey::mediaType();
         case NodeTypes::TOKEN_RECORD_ID:
             return AST\KeyValue\NativeKey::recordIdentifier();
         default:
             throw new InvalidArgumentException(sprintf('Unexpected token type "%s" for native key.', $type));
     }
 }
Пример #3
0
 public function keyProvider()
 {
     return [[NativeKey::database(), 'databox_name'], [NativeKey::collection(), 'collection_name'], [NativeKey::mediaType(), 'type'], [NativeKey::recordIdentifier(), 'record_id']];
 }