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_DATETIME = 'datetime';
30:
31: /**
32: * Gets primary key of $table
33: * @param string
34: * @return string
35: */
36: function getPrimary($table);
37:
38: /**
39: * Gets referenced table & referenced column
40: * Example:
41: * author, book returns array(book, author_id)
42: *
43: * @param string source table
44: * @param string referencing key
45: * @return array array(referenced table, referenced column)
46: */
47: function getHasManyReference($table, $key);
48:
49: /**
50: * Gets referenced table & referencing column
51: * Example
52: * book, author returns array(author, author_id)
53: * book, translator returns array(author, translator_id)
54: *
55: * @param string source table
56: * @param string referencing key
57: * @return string array(referenced table, referencing column)
58: */
59: function getBelongsToReference($table, $key);
60:
61: /**
62: * Injects database connection.
63: * @param Connection
64: */
65: function setConnection(Connection $connection);
66:
67: }
68: