summaryrefslogtreecommitdiff
path: root/framework/Data/ActiveRecord/Exceptions
diff options
context:
space:
mode:
authorwei <>2006-11-26 22:15:58 +0000
committerwei <>2006-11-26 22:15:58 +0000
commita8b3ebe8f62c3888b216d827c1c5dcba8a47d4e1 (patch)
tree5eef79dbc5e2f506047fa463cb427a40a7bd8441 /framework/Data/ActiveRecord/Exceptions
parent6773dfe453682d2b39a26fbabef8e706bf6bb412 (diff)
Adding active record implementation.
Diffstat (limited to 'framework/Data/ActiveRecord/Exceptions')
-rw-r--r--framework/Data/ActiveRecord/Exceptions/TActiveRecordException.php39
-rw-r--r--framework/Data/ActiveRecord/Exceptions/messages.txt12
2 files changed, 51 insertions, 0 deletions
diff --git a/framework/Data/ActiveRecord/Exceptions/TActiveRecordException.php b/framework/Data/ActiveRecord/Exceptions/TActiveRecordException.php
new file mode 100644
index 00000000..ec177a84
--- /dev/null
+++ b/framework/Data/ActiveRecord/Exceptions/TActiveRecordException.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * TActiveRecordException class file.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version $Id$
+ * @package System.Data.ActiveRecord.Exceptions
+ */
+
+/**
+ * Base exception class for Active Records.
+ *
+ * @author Wei Zhuo <weizho[at]gmail[dot]com>
+ * @version $Id$
+ * @package System.Data.ActiveRecord.Exceptions
+ * @since 3.1
+ */
+class TActiveRecordException extends TException
+{
+ /**
+ * @return string path to the error message file
+ */
+ protected function getErrorMessageFile()
+ {
+ $lang=Prado::getPreferredLanguage();
+ $path = dirname(__FILE__);
+ $msgFile=$path.'/messages-'.$lang.'.txt';
+ if(!is_file($msgFile))
+ $msgFile=$path.'/messages.txt';
+ return $msgFile;
+ }
+}
+
+class TActiveRecordConfigurationException extends TActiveRecordException
+{
+
+}
+
+?> \ No newline at end of file
diff --git a/framework/Data/ActiveRecord/Exceptions/messages.txt b/framework/Data/ActiveRecord/Exceptions/messages.txt
new file mode 100644
index 00000000..f77b2275
--- /dev/null
+++ b/framework/Data/ActiveRecord/Exceptions/messages.txt
@@ -0,0 +1,12 @@
+ar_readonly_exception = Active Record '{0}' is read only.
+ar_object_must_be_retrieved_before_delete = Active Record must be retrieved first before deletion.
+ar_object_must_not_be_null = Active record object must not be null.
+ar_object_marked_for_removal = Active record object already marked for removed.
+ar_column_meta_data_read_only = Column meta is read only.
+ar_invalid_database_driver = Active Record does not support database '{0}'.
+ar_invalid_finder_method = Unsupported Active Record finder method '{0}'.
+ar_no_primary_key_found = Table '{0}' does not contain any primary key fields.
+ar_primary_key_is_scalar = Primary key '{1}' in table '{0}' is NOT a composite key, invalid value '{2} used.
+ar_invalid_db_connection = Missing or invalid default database connection for ActiveRecord class '{0}', default connection is set by the DbConnection property of TActiveRecordManager.
+ar_mismatch_args_exception = ActiveRecord finder method '{0}' expects {1} parameters but found only {2} parameters instead.
+ar_invalid_tablename_property = ActiveRecord tablename property '{0}::${1}' must be static and not null. \ No newline at end of file