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\Database\Conventions\AmbiguousReferenceKeyException;
11:
12:
13: interface IConventions
14: {
15:
16: /**
17: * Returns primary key for table.
18: * @param string
19: * @return string|array|null
20: */
21: function getPrimary($table);
22:
23: /**
24: * Returns referenced table & referenced column.
25: * Example:
26: * (author, book) returns array(book, author_id)
27: *
28: * @param string source table
29: * @param string referencing key
30: * @return array|null array(referenced table, referenced column)
31: * @throws AmbiguousReferenceKeyException
32: */
33: function getHasManyReference($table, $key);
34:
35: /**
36: * Returns referenced table & referencing column.
37: * Example
38: * (book, author) returns array(author, author_id)
39: * (book, translator) returns array(author, translator_id)
40: *
41: * @param string source table
42: * @param string referencing key
43: * @return array|null array(referenced table, referencing column)
44: */
45: function getBelongsToReference($table, $key);
46: }
47: