gyro/core/model/base/dbfieldrelation.cls.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * A relation between two fields in DB 00004 * 00005 * @author Gerd Riesselmann 00006 * @ingroup Model 00007 */ 00008 class DBFieldRelation implements IDBFieldRelation { 00009 00010 protected $source_field; 00011 protected $target_field; 00012 00013 public function __construct($source_field, $target_field) { 00014 $this->source_field = $source_field; 00015 $this->target_field = $target_field; 00016 } 00017 00018 /** 00019 * Return source table name 00020 * 00021 * @return string 00022 */ 00023 public function get_source_field_name() { 00024 return $this->source_field; 00025 } 00026 00027 /** 00028 * Return target table name 00029 * 00030 * @return string 00031 */ 00032 public function get_target_field_name() { 00033 return $this->target_field; 00034 } 00035 00036 /** 00037 * Returns an IDBFieldRelation with source field as target field and vice versa 00038 * 00039 * @return IDBFieldRelation 00040 */ 00041 public function reverse() { 00042 return new DBFieldRelation($this->target_field, $this->source_field); 00043 } 00044 }