table_name = $table_name; $this->table_field = $table_field ? $table_field : $field_name; $this->error_message = $error_message; } function check($value) { $conn = lmbToolkit :: instance()->getDefaultDbConnection(); $sql = 'SELECT * FROM ' . $this->table_name . ' WHERE ' . $this->table_field . '=:value:'; $stmt = $conn->newStatement($sql); $stmt->setVarChar('value', $value); $rs = $stmt->getRecordSet(); if($rs->count() == 0) return; if($this->error_message) $this->error($this->error_message, array('Value' => $value)); else $this->error(lmb_i18n('{Field} must have other value since {Value} already exists', 'web_app'), array('Value' => $value)); } } ?>