Merge pull request #4185 from samuelsov/CRM-15330
[civicrm-core.git] / CRM / Core / Reference / Interface.php
1 <?php
2
3 /**
4 * Interface CRM_Core_Reference_Interface
5 */
6 interface CRM_Core_Reference_Interface {
7 public function getReferenceTable();
8
9 public function getReferenceKey();
10
11 /**
12 * Determine if a given table is a target of this reference.
13 *
14 * @param string $tableName
15 * @return bool
16 */
17 public function matchesTargetTable($tableName);
18
19 /**
20 * Create a query to find references to a particular record
21 *
22 * @param CRM_Core_DAO $targetDao
23 * The instance for which we want references.
24 * @return CRM_Core_DAO|NULL a query-handle (like the result of CRM_Core_DAO::executeQuery)
25 */
26 public function findReferences($targetDao);
27
28 /**
29 * Create a query to find references to a particular record
30 *
31 * @param CRM_Core_DAO $targetDao
32 * The instance for which we want references.
33 * @return array
34 * a record describing the reference; must include the keys:
35 * - 'type': string (not necessarily unique)
36 * - 'count': int
37 */
38 public function getReferenceCount($targetDao);
39
40 }