Skip to content

Commit c6f78a3

Browse files
authored
Merge pull request #1486 from cfwheels/architecture-3.0
2 parents 4fdd5e3 + 100b853 commit c6f78a3

File tree

14 files changed

+99
-49
lines changed

14 files changed

+99
-49
lines changed

vendor/wheels/model/sql.cfc

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,10 @@ component {
282282
local.rv = "";
283283
local.addedProperties = "";
284284
local.addedPropertiesByModel = {};
285-
local.iEnd = ListLen(arguments.list);
285+
local.selectArray = $splitByCommasOutsideFunctions(arguments.list);
286+
local.iEnd = arrayLen(local.selectArray);
286287
for (local.i = 1; local.i <= local.iEnd; local.i++) {
287-
local.iItem = Trim(ListGetAt(arguments.list, local.i));
288+
local.iItem = Trim(local.selectArray[i]);
288289

289290
// look for duplicates
290291
local.duplicateCount = ListValueCountNoCase(local.addedProperties, local.iItem);
@@ -920,4 +921,45 @@ component {
920921
}
921922
return local.rv;
922923
}
924+
925+
public array function $splitByCommasOutsideFunctions(required string list) {
926+
local.rv = [];
927+
local.temp = "";
928+
local.insideFunction = false;
929+
local.bracketCount = 0;
930+
931+
for (i = 1; i <= len(arguments.list); i++) {
932+
local.char = mid(arguments.list, i, 1);
933+
934+
// Check if we are entering or exiting a function's parentheses
935+
if (local.char == "(") {
936+
local.bracketCount++;
937+
} else if (local.char == ")") {
938+
local.bracketCount--;
939+
}
940+
941+
// Determine if we are inside a function (any content enclosed by parentheses)
942+
if (local.bracketCount > 0) {
943+
local.insideFunction = true;
944+
} else if (local.bracketCount == 0) {
945+
local.insideFunction = false;
946+
}
947+
948+
// Split based on commas outside functions
949+
if (local.char == "," && !local.insideFunction) {
950+
arrayAppend(local.rv, trim(local.temp));
951+
local.temp = "";
952+
} else {
953+
local.temp &= local.char;
954+
}
955+
}
956+
957+
// Append the final segment
958+
if (len(trim(local.temp))) {
959+
arrayAppend(local.rv, trim(local.temp));
960+
}
961+
962+
return local.rv;
963+
}
964+
923965
}

vendor/wheels/tests/model/validations/conditional_validations.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
component extends="wheels.tests.Test" {
22

33
function setup() {
4-
user = CreateObject("component", "wheels.tests._assets.models.Model").$initModelClass(
4+
user = application.wirebox.getInstance( "wheels.tests._assets.models.Model" ).$initModelClass(
55
name = "Users",
66
path = get("modelPath")
77
);

vendor/wheels/tests/plugins/dependant.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ component extends="wheels.tests.Test" {
66
config = {
77
path = "wheels",
88
fileName = "Plugins",
9-
method = "init",
9+
method = "$init",
1010
pluginPath = "/wheels/tests/_assets/plugins/standard",
1111
deletePluginDirectories = false,
1212
overwritePlugins = false,

vendor/wheels/tests/plugins/injection.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ component extends="wheels.tests.Test" {
66
config = {
77
path = "wheels",
88
fileName = "Plugins",
9-
method = "init",
9+
method = "$init",
1010
pluginPath = "/wheels/tests/_assets/plugins/standard",
1111
deletePluginDirectories = false,
1212
overwritePlugins = false,
@@ -18,7 +18,7 @@ component extends="wheels.tests.Test" {
1818
_params = {controller = "test", action = "index"};
1919
c = controller("test", _params);
2020
d = $createObjectFromRoot(path = "wheels", fileName = "Dispatch", method = "$init");
21-
t = CreateObject("component", "wheels.Test");
21+
t = application.wirebox.getInstance("wheels.Test");
2222
}
2323

2424
function teardown() {

vendor/wheels/tests/plugins/overwriting.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ component extends="wheels.tests.Test" {
66
config = {
77
path = "wheels",
88
fileName = "Plugins",
9-
method = "init",
9+
method = "$init",
1010
pluginPath = "/wheels/tests/_assets/plugins/overwriting",
1111
deletePluginDirectories = false,
1212
overwritePlugins = true,

vendor/wheels/tests/plugins/removing.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ component extends="wheels.tests.Test" {
66
config = {
77
path = "wheels",
88
fileName = "Plugins",
9-
method = "init",
9+
method = "$init",
1010
pluginPath = "/wheels/tests/_assets/plugins/removing",
1111
deletePluginDirectories = true,
1212
overwritePlugins = false,

vendor/wheels/tests/plugins/runner.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ component extends="wheels.tests.Test" {
1818
config = {
1919
path = "wheels",
2020
fileName = "Plugins",
21-
method = "init",
21+
method = "$init",
2222
pluginPath = "/wheels/tests/_assets/plugins/runner",
2323
deletePluginDirectories = false,
2424
overwritePlugins = false,

vendor/wheels/tests/plugins/standard.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ component extends="wheels.tests.Test" {
66
config = {
77
path = "wheels",
88
fileName = "Plugins",
9-
method = "init",
9+
method = "$init",
1010
pluginPath = "/wheels/tests/_assets/plugins/standard",
1111
deletePluginDirectories = false,
1212
overwritePlugins = false,

vendor/wheels/tests/plugins/unpacking.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ component extends="wheels.tests.Test" {
66
config = {
77
path = "wheels",
88
fileName = "Plugins",
9-
method = "init",
9+
method = "$init",
1010
pluginPath = "/wheels/tests/_assets/plugins/unpacking",
1111
deletePluginDirectories = false,
1212
overwritePlugins = false,

vendor/wheels/tests/view/forms/checkbox.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
component extends="wheels.tests.Test" {
22

33
function setup() {
4-
_controller = CreateObject("component", "wheels.tests._assets.controllers.ControllerWithModel");
4+
_controller = application.wirebox.getInstance("wheels.tests._assets.controllers.ControllerWithModel");
55
args = {};
66
args.objectName = "user";
77
args.label = false;

0 commit comments

Comments
 (0)