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: */
11:
12: namespace Nette\Database;
13:
14: use Nette;
15:
16:
17:
18: /**
19: * Information about tables and columns structure.
20: */
21: interface IReflection
22: {
23: const
24: FIELD_TEXT = 'string',
25: FIELD_BINARY = 'bin',
26: FIELD_BOOL = 'bool',
27: FIELD_INTEGER = 'int',
28: FIELD_FLOAT = 'float',
29: FIELD_DATE = 'date',
30: FIELD_TIME = 'time',
31: FIELD_DATETIME = 'datetime';
32:
33: /**
34: * Gets primary key of $table
35: * @param string
36: * @return string
37: */
38: function getPrimary($table);
39:
40: /**
41: * Gets referenced table & referenced column
42: * Example:
43: * author, book returns array(book, author_id)
44: *
45: * @param string source table
46: * @param string referencing key
47: * @return array array(referenced table, referenced column)
48: */
49: function getHasManyReference($table, $key);
50:
51: /**
52: * Gets referenced table & referencing column
53: * Example
54: * book, author returns array(author, author_id)
55: * book, translator returns array(author, translator_id)
56: *
57: * @param string source table
58: * @param string referencing key
59: * @return array array(referenced table, referencing column)
60: */
61: function getBelongsToReference($table, $key);
62:
63: /**
64: * Injects database connection.
65: * @param Connection
66: */
67: function setConnection(Connection $connection);
68:
69: }
70: