1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: *
6: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
7: *
8: * For the full copyright and license information, please view
9: * the file license.txt that was distributed with this source code.
10: * @package Nette\Database
11: */
12:
13:
14:
15: /**
16: * Information about tables and columns structure.
17: * @package Nette\Database
18: */
19: interface IReflection
20: {
21: const
22: FIELD_TEXT = 'string',
23: FIELD_BINARY = 'bin',
24: FIELD_BOOL = 'bool',
25: FIELD_INTEGER = 'int',
26: FIELD_FLOAT = 'float',
27: FIELD_DATETIME = 'datetime';
28:
29: /**
30: * Gets primary key of $table
31: * @param string
32: * @return string
33: */
34: function getPrimary($table);
35:
36: /**
37: * Gets referenced table & referenced column
38: * Example:
39: * author, book returns array(book, author_id)
40: *
41: * @param string source table
42: * @param string referencing key
43: * @return array array(referenced table, referenced column)
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 string array(referenced table, referencing column)
56: */
57: function getBelongsToReference($table, $key);
58:
59: /**
60: * Injects database connection.
61: * @param NConnection
62: */
63: function setConnection(NConnection $connection);
64:
65: }
66: