gyro/core/lib/interfaces/idbrelation.cls.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Interface for a DB relation 00004 * 00005 * We use terminology source and target here. Of course what is source and what is target depends on 00006 * the perspective, so we could also call this A and B. 00007 * 00008 * A relation is defined for one field on source table that relates to one field on target table 00009 * 00010 * @author Gerd Riesselmann 00011 * @ingroup Interfaces 00012 */ 00013 interface IDBRelation extends IPolicyHolder { 00014 /** 00015 * Return target table name 00016 * 00017 * @return string 00018 */ 00019 public function get_target_table_name(); 00020 00021 /** 00022 * Returns field taking parts in this relation 00023 * 00024 * @return array Associative array with column name as key and IDFieldRelation instance as value 00025 */ 00026 public function get_fields(); 00027 00028 /** 00029 * Returns array of fields, but fields get reversed before 00030 * 00031 * @return array Associative array with column name as key and IDFieldRelation instance as value 00032 */ 00033 public function get_reversed_fields(); 00034 00035 /** 00036 * Returns true, if null values are allowed 00037 * 00038 * @return bool 00039 */ 00040 public function get_null_allowed(); 00041 00042 /** 00043 * Check if relation conditions are fullfiled. This checks from a source perspective, that is: 00044 * 00045 * - See if source field conditions are met (e.g. NOT NULL) 00046 * - Check if there is a least one record on target table 00047 * 00048 * @param array Associative array of form fieldname => fieldvalue 00049 * @return Status 00050 */ 00051 public function validate($arr_fields); 00052 00053 /** 00054 * Returns type of relation 00055 * 00056 * @return int 00057 */ 00058 public function get_type(); 00059 }