summaryrefslogtreecommitdiff
path: root/framework/DataAccess/SQLMap/DataMapper
diff options
context:
space:
mode:
Diffstat (limited to 'framework/DataAccess/SQLMap/DataMapper')
-rw-r--r--framework/DataAccess/SQLMap/DataMapper/TPropertyAccess.php6
-rw-r--r--framework/DataAccess/SQLMap/DataMapper/TTypeHandlerFactory.php10
-rw-r--r--framework/DataAccess/SQLMap/DataMapper/messages.txt13
3 files changed, 17 insertions, 12 deletions
diff --git a/framework/DataAccess/SQLMap/DataMapper/TPropertyAccess.php b/framework/DataAccess/SQLMap/DataMapper/TPropertyAccess.php
index 4bbe2cb5..e4f5c1fa 100644
--- a/framework/DataAccess/SQLMap/DataMapper/TPropertyAccess.php
+++ b/framework/DataAccess/SQLMap/DataMapper/TPropertyAccess.php
@@ -39,7 +39,7 @@ class TPropertyAccess
*/
public static function get($object,$path)
{
- if(!is_array($object) || !is_object($object))
+ if(!is_array($object) && !is_object($object))
return $object;
$properties = explode('.', $path);
foreach($properties as $prop)
@@ -49,7 +49,7 @@ class TPropertyAccess
if(isset($object[$prop]))
$object = $object[$prop];
else
- throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
+ throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
}
else if(is_object($object))
{
@@ -69,7 +69,7 @@ class TPropertyAccess
public static function has($object, $path)
{
- if(!is_array($object) || !is_object($object))
+ if(!is_array($object) && !is_object($object))
return false;
$properties = explode('.', $path);
foreach($properties as $prop)
diff --git a/framework/DataAccess/SQLMap/DataMapper/TTypeHandlerFactory.php b/framework/DataAccess/SQLMap/DataMapper/TTypeHandlerFactory.php
index fcadea28..55fb1f20 100644
--- a/framework/DataAccess/SQLMap/DataMapper/TTypeHandlerFactory.php
+++ b/framework/DataAccess/SQLMap/DataMapper/TTypeHandlerFactory.php
@@ -55,8 +55,10 @@ class TTypeHandlerFactory
case 'integer': case 'int': return 0;
case 'bool': case 'boolean': return false;
}
-
- if(class_exists($type, false)) //NO auto loading
+
+ if(class_exists('Prado', false))
+ return Prado::createComponent($type);
+ else if(class_exists($type, false)) //NO auto loading
return new $type;
else
throw new TDataMapperException('sqlmap_unable_to_find_class', $type);
@@ -125,10 +127,10 @@ interface ITypeHandlerCallback
* for this type (e.g. File type), you can simply return the String representation
* as it was passed in. It is not recommended to return null, unless null was passed
* in.
- * @param string nullValue.
+ * @param array result row.
* @return mixed
*/
- public function createNewInstance();
+ public function createNewInstance($row=null);
}
?> \ No newline at end of file
diff --git a/framework/DataAccess/SQLMap/DataMapper/messages.txt b/framework/DataAccess/SQLMap/DataMapper/messages.txt
index 6bf5f396..16be9c2b 100644
--- a/framework/DataAccess/SQLMap/DataMapper/messages.txt
+++ b/framework/DataAccess/SQLMap/DataMapper/messages.txt
@@ -17,6 +17,8 @@ map_item_unremovable = The item cannot be removed from the map.
map_data_not_iterable = Data must be either an array or an object implementing Traversable interface.
map_readonly = {0} is read-only.
+sqlmap_type_handler_class_undef = Unable to find type handler class named '{1}' in sqlmap configuration file '{0}'.
+sqlmap_type_handler_callback_undef = Attributes 'type' and 'callback' must be defined in typeHandler tag in configuration file '{0}'.
sqlmap_contains_no_statement = Unable to find SQLMap statement '{0}'.
sqlmap_already_contains_statement = Duplicate SQLMap statement found, '{0}' already exists.
sqlmap_contains_no_result_map = Unable to find SQLMap result map '{0}'.
@@ -27,6 +29,7 @@ sqlmap_connection_already_exists = SqlMap could not invoke OpenConnection(). A
sqlmap_unable_to_close_null_connection = SqlMap could not invoke CloseConnection(). No connection was started. Call OpenConnection() first.
sqlmap_undefined_attribute = {0} attribute '{1}' is not defined for {2} in file {3}.
sqlmap_unable_find_provider_class = Unable to find a database provider in SQLMap configuration file {0}.
+sqlmap_unable_find_provider_class_def = Unable to load class database provider '{1}' in SQLMap configuration file {0}.
sqlmap_unable_to_find_parent_parameter_map = Unable to find parent parameter map extension '{0}' in file {1}.
sqlmap_unable_to_find_parent_sql = Unable to find parent sql statement extension '{0}' in file {1}.
sqlmap_unable_to_find_result_mapping = Unable to resolve SQLMap result mapping '{0}' in Result Map '{2}' using configuration file {1}.
@@ -36,11 +39,11 @@ sqlmap_index_must_be_string_or_int = Invalid index '{0}', must be an integes or
sqlmap_undefined_input_property = Undefined array index '{0}' in retrieving property in SQLMap parameter map '{1}'.
sqlmap_unable_to_find_class = Unable to find result class '{0}' in TResultMap::createInstanceOfResult().
sqlmap_can_not_instantiate = Type handler '{0}' can not create new objects.
-sqlmap_cannot_execute_query_for_map = SQLMap statement class {0} can not query for map.
-sqlmap_cannot_execute_update = SQLMap statement class {0} can not execute update query.
-sqlmap_cannot_execute_insert = SQLMap statement class {0} can not execute insert.
-sqlmap_cannot_execute_query_for_list = SQLMap statement class {0} can not query for list.
-sqlmap_cannot_execute_query_for_object = SQLMap statement class {0} can not query for object
+sqlmap_cannot_execute_query_for_map = SQLMap statement class {0} can not query for map in statement '{1}'.
+sqlmap_cannot_execute_update = SQLMap statement class {0} can not execute update query in statement '{1}'.
+sqlmap_cannot_execute_insert = SQLMap statement class {0} can not execute insert in statement '{1}'.
+sqlmap_cannot_execute_query_for_list = SQLMap statement class {0} can not query for list in statement '{1}'.
+sqlmap_cannot_execute_query_for_object = SQLMap statement class {0} can not query for object in statement '{1}'.
sqlmap_execution_error_no_record = No record set found in executing statement '{0}': '{1}'.
sqlmap_unable_to_create_new_instance = Unable to create a new instance of '{0}' using type hander '{1}' for SQLMap statement with ID '{2}'.
sqlmap_invalid_property = Invalid property getter path '{0}'.