1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
6: * @package Nette\Database
7: */
8:
9:
10:
11: /**
12: * Information about tables and columns structure.
13: * @package Nette\Database
14: */
15: interface IReflection
16: {
17: const
18: FIELD_TEXT = 'string',
19: FIELD_BINARY = 'bin',
20: FIELD_BOOL = 'bool',
21: FIELD_INTEGER = 'int',
22: FIELD_FLOAT = 'float',
23: FIELD_DATE = 'date',
24: FIELD_TIME = 'time',
25: FIELD_DATETIME = 'datetime';
26:
27: /**
28: * Gets primary key of $table.
29: * @param string
30: * @return string
31: */
32: function getPrimary($table);
33:
34: /**
35: * Gets referenced table & referenced column.
36: * Example:
37: * author, book returns array(book, author_id)
38: *
39: * @param string source table
40: * @param string referencing key
41: * @return array array(referenced table, referenced column)
42: * @throws MissingReferenceException
43: * @throws AmbiguousReferenceKeyException
44: */
45: function getHasManyReference($table, $key);
46:
47: /**
48: * Gets referenced table & referencing column.
49: * Example
50: * book, author returns array(author, author_id)
51: * book, translator returns array(author, translator_id)
52: *
53: * @param string source table
54: * @param string referencing key
55: * @return array array(referenced table, referencing column)
56: * @throws MissingReferenceException
57: */
58: function getBelongsToReference($table, $key);
59:
60: /**
61: * Injects database connection.
62: */
63: function setConnection(Connection $connection);
64:
65: }
66: