gyro/core/model/base/dbconstraint.cls.php
Go to the documentation of this file.00001 <?php 00002 Load::components('policyholder'); 00003 00004 /** 00005 * Base class for constraints 00006 * 00007 * @author Gerd Riesselmann 00008 * @ingroup Model 00009 */ 00010 class DBConstraint extends PolicyHolder implements IDBConstraint { 00011 const NONE = 0; 00012 /** 00013 * The table this contraint holds for 00014 * 00015 * @var string 00016 */ 00017 protected $tablename; 00018 /** 00019 * Array of field names 00020 * 00021 * @var array 00022 */ 00023 protected $arr_fields = array(); 00024 00025 public function __construct($tablename, $fields = null, $policy = self::NONE) { 00026 parent::__construct($policy); 00027 $this->tablename = $tablename; 00028 00029 if (!empty($fields)) { 00030 $this->arr_fields = Arr::force($fields); 00031 } 00032 } 00033 00034 /** 00035 * Returns field taking parts in this relation 00036 * 00037 * @return array Array with column name as value 00038 */ 00039 public function get_fields() { 00040 return $this->arr_fields; 00041 } 00042 00043 /** 00044 * Check if constraints are fullfiled. 00045 * 00046 * @param array Cosntraint Column data Associative array of form fieldname => fieldvalue 00047 * @param array Key Column Data Associative array of form fieldname => fieldvalue 00048 * @return Status 00049 */ 00050 public function validate($arr_fields, $arr_keys) { 00051 return new Status(); 00052 } 00053 }