1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (https://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: FIELD_UNIX_TIMESTAMP = 'timestamp',
28: FIELD_TIME_INTERVAL = 'timeint';
29:
30: /**
31: * Gets primary key of $table.
32: * @param string
33: * @return string|array
34: */
35: function getPrimary($table);
36:
37: /**
38: * Gets referenced table & referenced column.
39: * Example:
40: * author, book returns array(book, author_id)
41: *
42: * @param string source table
43: * @param string referencing key
44: * @return array array(referenced table, referenced column)
45: * @throws Reflection\MissingReferenceException
46: * @throws Reflection\AmbiguousReferenceKeyException
47: */
48: function getHasManyReference($table, $key);
49:
50: /**
51: * Gets referenced table & referencing column.
52: * Example
53: * book, author returns array(author, author_id)
54: * book, translator returns array(author, translator_id)
55: *
56: * @param string source table
57: * @param string referencing key
58: * @return array array(referenced table, referencing column)
59: * @throws Reflection\MissingReferenceException
60: */
61: function getBelongsToReference($table, $key);
62:
63: }
64: