/**
  * Register a new object type
  * 
  * @static
  * @since 1.1.0
  * @param string $type_identifier 3-character object_id prefix
  * @param string $type_name 
  * @return true|/argent_error 
  */
 public static function register_object_type($type_identifier = NULL, $type_name = NULL, $table = NULL)
 {
     $db = new argent_database();
     $error = new argent_error();
     // Check the identifier is set
     if (empty($type_identifier) || strlen($type_identifier) != 3) {
         $error->add('1033', 'Invalid type identifier', $type_identifier, 'argent_meta');
     }
     // Check the type name is set
     if (empty($type_name) || !is_string($type_name) || is_numeric(substr($type_name, 0, 1))) {
         $error->add('1034', 'Invalid type name', $type_name, 'argent_meta');
     }
     // Check it's not a system type
     if (self::is_system_type($type_identifier)) {
         $error->add('1037', 'System type cannot be modified', $type_identifier . ' > ' . $type_name, 'argent_meta');
     }
     // Check if the given table exists
     if (!$db->table_exists($table)) {
         $error->add('1050', 'Table does not exist', $table, 'argent_meta');
     }
     // Check that the object type is not already registered
     $sql = "\r\n                        SELECT\r\n                            *\r\n                        FROM\r\n                            `ua_object_types`\r\n                        WHERE\r\n                            `type_identifier` = '{$db->escape_value(strtoupper($type_identifier))}'\r\n                        OR\r\n                            `type_name` LIKE '{$db->escape_value($type_name)}'\r\n                        ";
     $data = $db->returntable($sql);
     if (count($data) > 0) {
         $error->add('1035', 'A similar object type definition already exists', $type_identifier . ' > ' . $type_name, 'argent_meta');
     }
     if ($error->has_errors()) {
         return $error;
     }
     $sql = "\r\n                        INSERT INTO\r\n                            `ua_object_types`\r\n                        VALUES(\r\n                            '{$db->escape_value(strtoupper($type_identifier))}',\r\n                            '{$db->escape_value($type_name)}',\r\n                            '{$db->escape_value($table)}'\r\n                        )\r\n                        ";
     $res = $db->query($sql);
     if ($res) {
         return true;
     }
     $error->add('1000', 'Database error', $db->lastquery, 'argent_meta');
     return $error;
 }