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: * @throws Reflection\MissingReferenceException
49: * @throws Reflection\AmbiguousReferenceKeyException
50: */
51: function getHasManyReference($table, $key);
52:
53: /**
54: * Gets referenced table & referencing column.
55: * Example
56: * book, author returns array(author, author_id)
57: * book, translator returns array(author, translator_id)
58: *
59: * @param string source table
60: * @param string referencing key
61: * @return array array(referenced table, referencing column)
62: * @throws Reflection\MissingReferenceException
63: */
64: function getBelongsToReference($table, $key);
65:
66: /**
67: * Injects database connection.
68: */
69: function setConnection(Connection $connection);
70:
71: }
72: