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