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