Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
caldera-forms-query
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
plugins
cf-dependencies
caldera-forms-query
Commits
527d79ed
Commit
527d79ed
authored
6 years ago
by
Josh Pollock
Browse files
Options
Downloads
Patches
Plain Diff
select by form id
parent
9fa2016d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+1
-0
1 addition, 0 deletions
README.md
composer.lock
+38
-38
38 additions, 38 deletions
composer.lock
src/Features/FeatureContainer.php
+293
-271
293 additions, 271 deletions
src/Features/FeatureContainer.php
with
332 additions
and
309 deletions
README.md
+
1
−
0
View file @
527d79ed
...
...
@@ -49,6 +49,7 @@ CalderaFormsQueries()->deleteByUserId(42);
```
## Development
### Install
Requires git and Composer
...
...
This diff is collapsed.
Click to expand it.
composer.lock
+
38
−
38
View file @
527d79ed
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#
composer-lock-the-lock-file
",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#
installing-dependencies
",
"This file is @generated automatically"
],
"content-hash": "
736a984915e9e1f970336e5a8e5b38eb
",
"content-hash": "
66049b1b98fbc3be0172f1d471393cb3
",
"packages": [
{
"name": "calderawp/caldera-containers",
...
...
@@ -273,7 +273,7 @@
"version": "dev-feature/2404",
"source": {
"type": "git",
"url": "
git@
github.com
:
CalderaWP/Caldera-Forms
.git
",
"url": "
https://
github.com
/
CalderaWP/Caldera-Forms",
"reference": "c4c2d1db6042c82f2229c89ed7140c8b214c9c8e"
},
"type": "wordpress-plugin",
...
...
@@ -819,23 +819,23 @@
},
{
"name": "phpspec/prophecy",
"version": "1.7.
5
",
"version": "1.7.
6
",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "
dfd6be44111a7c41c2e884a336cc4f461b3b2401
"
"reference": "
33a7e3c4fda54e912ff6338c48823bd5c0f0b712
"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/
dfd6be44111a7c41c2e884a336cc4f461b3b2401
",
"reference": "
dfd6be44111a7c41c2e884a336cc4f461b3b2401
",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/
33a7e3c4fda54e912ff6338c48823bd5c0f0b712
",
"reference": "
33a7e3c4fda54e912ff6338c48823bd5c0f0b712
",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0",
"sebastian/comparator": "^1.1|^2.0",
"sebastian/comparator": "^1.1|^2.0
|^3.0
",
"sebastian/recursion-context": "^1.0|^2.0|^3.0"
},
"require-dev": {
...
...
@@ -878,20 +878,20 @@
"spy",
"stub"
],
"time": "2018-0
2
-1
9
T1
0:16:5
4+00:00"
"time": "2018-0
4
-1
8
T1
3:57:2
4+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "6.0.
1
",
"version": "6.0.
4
",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "
f8ca4b604baf23dab89d87773c28cc07405189b
a"
"reference": "
52187754b0eed0b8159f62a6fa30073327e8c2c
a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/
f8ca4b604baf23dab89d87773c28cc07405189b
a",
"reference": "
f8ca4b604baf23dab89d87773c28cc07405189b
a",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/
52187754b0eed0b8159f62a6fa30073327e8c2c
a",
"reference": "
52187754b0eed0b8159f62a6fa30073327e8c2c
a",
"shasum": ""
},
"require": {
...
...
@@ -902,7 +902,7 @@
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-token-stream": "^3.0",
"sebastian/code-unit-reverse-lookup": "^1.0.1",
"sebastian/environment": "^3.
0
",
"sebastian/environment": "^3.
1
",
"sebastian/version": "^2.0.1",
"theseer/tokenizer": "^1.1"
},
...
...
@@ -941,7 +941,7 @@
"testing",
"xunit"
],
"time": "2018-0
2-02T07:01:41
+00:00"
"time": "2018-0
4-29T14:59:09
+00:00"
},
{
"name": "phpunit/php-file-iterator",
...
...
@@ -1131,16 +1131,16 @@
},
{
"name": "phpunit/phpunit",
"version": "7.
0.3
",
"version": "7.
1.5
",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "
536f4d853c12d8189963435088e8ff7c0daeab2e
"
"reference": "
ca64dba53b88aba6af32aebc6b388068db95c435
"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/
536f4d853c12d8189963435088e8ff7c0daeab2e
",
"reference": "
536f4d853c12d8189963435088e8ff7c0daeab2e
",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/
ca64dba53b88aba6af32aebc6b388068db95c435
",
"reference": "
ca64dba53b88aba6af32aebc6b388068db95c435
",
"shasum": ""
},
"require": {
...
...
@@ -1158,8 +1158,8 @@
"phpunit/php-file-iterator": "^1.4.3",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-timer": "^2.0",
"phpunit/phpunit-mock-objects": "^6.
0
",
"sebastian/comparator": "^
2.1
",
"phpunit/phpunit-mock-objects": "^6.
1.1
",
"sebastian/comparator": "^
3.0
",
"sebastian/diff": "^3.0",
"sebastian/environment": "^3.1",
"sebastian/exporter": "^3.1",
...
...
@@ -1181,7 +1181,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "7.
0
-dev"
"dev-master": "7.
1
-dev"
}
},
"autoload": {
...
...
@@ -1207,20 +1207,20 @@
"testing",
"xunit"
],
"time": "2018-0
3
-2
6T07:36:48
+00:00"
"time": "2018-0
4
-2
9T15:09:19
+00:00"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "6.
0
.1",
"version": "6.
1
.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "
e3249dedc2d99259ccae6affbc2684eac37c2e53
"
"reference": "
70c740bde8fd9ea9ea295be1cd875dd7b267e157
"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/
e3249dedc2d99259ccae6affbc2684eac37c2e53
",
"reference": "
e3249dedc2d99259ccae6affbc2684eac37c2e53
",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/
70c740bde8fd9ea9ea295be1cd875dd7b267e157
",
"reference": "
70c740bde8fd9ea9ea295be1cd875dd7b267e157
",
"shasum": ""
},
"require": {
...
...
@@ -1238,7 +1238,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.
0.x
-dev"
"dev-master": "6.
1
-dev"
}
},
"autoload": {
...
...
@@ -1263,7 +1263,7 @@
"mock",
"xunit"
],
"time": "2018-0
2
-1
5
T0
5:27
:3
8
+00:00"
"time": "2018-0
4
-1
1
T0
4:50
:3
6
+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
...
...
@@ -1312,30 +1312,30 @@
},
{
"name": "sebastian/comparator",
"version": "
2.1.3
",
"version": "
3.0.0
",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "
34369daee48eafb2651bea869b4b15d75ccc35f9
"
"reference": "
ed5fd2281113729f1ebcc64d101ad66028aeb3d5
"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/
34369daee48eafb2651bea869b4b15d75ccc35f9
",
"reference": "
34369daee48eafb2651bea869b4b15d75ccc35f9
",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/
ed5fd2281113729f1ebcc64d101ad66028aeb3d5
",
"reference": "
ed5fd2281113729f1ebcc64d101ad66028aeb3d5
",
"shasum": ""
},
"require": {
"php": "^7.
0
",
"sebastian/diff": "
^2.0 ||
^3.0",
"php": "^7.
1
",
"sebastian/diff": "^3.0",
"sebastian/exporter": "^3.1"
},
"require-dev": {
"phpunit/phpunit": "^
6.4
"
"phpunit/phpunit": "^
7.1
"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "
2.1.x
-dev"
"dev-master": "
3.0
-dev"
}
},
"autoload": {
...
...
@@ -1372,7 +1372,7 @@
"compare",
"equality"
],
"time": "2018-0
2-01T13:46:46
+00:00"
"time": "2018-0
4-18T13:33:00
+00:00"
},
{
"name": "sebastian/diff",
...
...
This diff is collapsed.
Click to expand it.
src/Features/FeatureContainer.php
+
293
−
271
View file @
527d79ed
...
...
@@ -20,297 +20,319 @@ use calderawp\CalderaFormsQuery\SelectQueries;
class
FeatureContainer
extends
Container
{
/**
* @var ServiceContainer
*/
protected
$serviceContainer
;
/**
* @var \wpdb
*/
protected
$wpdb
;
/**
* @var ServiceContainer
*/
protected
$serviceContainer
;
/**
* @var \wpdb
*/
protected
$wpdb
;
/**
* FeatureContainer constructor.
* @param ServiceContainer $serviceContainer
* @param \wpdb $wpdb
*/
public
function
__construct
(
ServiceContainer
$serviceContainer
,
\wpdb
$wpdb
)
{
$this
->
serviceContainer
=
$serviceContainer
;
$this
->
wpdb
=
$wpdb
;
$this
->
bindServices
();
}
/**
* FeatureContainer constructor.
* @param ServiceContainer $serviceContainer
* @param \wpdb $wpdb
*/
public
function
__construct
(
ServiceContainer
$serviceContainer
,
\wpdb
$wpdb
)
{
$this
->
serviceContainer
=
$serviceContainer
;
$this
->
wpdb
=
$wpdb
;
$this
->
bindServices
();
}
/**
* Bind services to service container
*/
protected
function
bindServices
()
{
//@TODO move these to service provider classes
$this
->
serviceContainer
->
singleton
(
MySqlBuilder
::
class
,
function
()
{
return
new
MySqlBuilder
();
});
/**
* Bind services to service container
*/
protected
function
bindServices
()
{
//@TODO move these to service provider classes
$this
->
serviceContainer
->
singleton
(
MySqlBuilder
::
class
,
function
()
{
return
new
MySqlBuilder
();
});
$this
->
serviceContainer
->
bind
(
SelectQueries
::
class
,
function
()
{
//@TODO Factory
return
new
SelectQueries
(
new
EntrySelect
(
$this
->
getBuilder
(),
$this
->
entryTableName
()
),
new
EntryValueSelect
(
$this
->
getBuilder
(),
$this
->
entryValueTableName
()
),
$this
->
wpdb
);
});
$this
->
serviceContainer
->
bind
(
SelectQueries
::
class
,
function
()
{
//@TODO Factory
return
new
SelectQueries
(
new
EntrySelect
(
$this
->
getBuilder
(),
$this
->
entryTableName
()
),
new
EntryValueSelect
(
$this
->
getBuilder
(),
$this
->
entryValueTableName
()
),
$this
->
wpdb
);
});
$this
->
serviceContainer
->
bind
(
DeleteQueries
::
class
,
function
()
{
//@TODO Factory
return
new
DeleteQueries
(
new
EntryDelete
(
$this
->
getBuilder
(),
$this
->
entryTableName
()
),
new
EntryValuesDelete
(
$this
->
getBuilder
(),
$this
->
entryValueTableName
()
),
$this
->
wpdb
);
});
$this
->
serviceContainer
->
bind
(
DeleteQueries
::
class
,
function
()
{
//@TODO Factory
return
new
DeleteQueries
(
new
EntryDelete
(
$this
->
getBuilder
(),
$this
->
entryTableName
()
),
new
EntryValuesDelete
(
$this
->
getBuilder
(),
$this
->
entryValueTableName
()
),
$this
->
wpdb
);
});
$this
->
serviceContainer
->
singleton
(
Queries
::
class
,
function
()
{
return
new
Queries
(
$this
->
serviceContainer
->
make
(
SelectQueries
::
class
),
$this
->
serviceContainer
->
make
(
DeleteQueries
::
class
)
);
});
}
$this
->
serviceContainer
->
singleton
(
Queries
::
class
,
function
()
{
return
new
Queries
(
$this
->
serviceContainer
->
make
(
SelectQueries
::
class
),
$this
->
serviceContainer
->
make
(
DeleteQueries
::
class
)
);
});
}
/**
* Get MySQL builder
*
* @return MySqlBuilder
*/
public
function
getBuilder
()
{
return
$this
->
serviceContainer
->
make
(
MySqlBuilder
::
class
);
}
/**
* Get MySQL builder
*
* @return MySqlBuilder
*/
public
function
getBuilder
()
{
return
$this
->
serviceContainer
->
make
(
MySqlBuilder
::
class
);
}
/**
* Get query runner
*
* @return Queries
*/
public
function
getQueries
()
{
return
$this
->
serviceContainer
->
make
(
Queries
::
class
);
}
/**
* Get query runner
*
* @return Queries
*/
public
function
getQueries
()
{
return
$this
->
serviceContainer
->
make
(
Queries
::
class
);
}
/**
* Select all entries and entry values by user ID
*
* @param int $userId
* @return array
*/
public
function
selectByUserId
(
$userId
)
{
$query
=
$this
->
getQueries
()
->
entrySelect
()
->
queryByUserId
(
$userId
);
return
$this
->
collectResults
(
$this
->
select
(
$query
));
}
/**
* Select all entries and entry values by user ID
*
* @param int $userId
* @return array
*/
public
function
selectByUserId
(
$userId
)
{
$query
=
$this
->
getQueries
()
->
entrySelect
()
->
queryByUserId
(
$userId
);
return
$this
->
collectResults
(
$this
->
select
(
$query
));
}
/**
* Find all entries that have or do not have field with a slug and value
*
* @param string $fieldSlug Field slug
* @param string $fieldValue Field value
* @param bool $have Optional. Default: true. If true query is for fields with this value
*
* @return array
*/
public
function
selectByFieldValue
(
$fieldSlug
,
$fieldValue
,
$have
=
true
)
{
$type
=
$have
?
'equals'
:
'notEquals'
;
$queryForEntryValues
=
$this
->
getQueries
()
->
entryValuesSelect
()
->
queryByFieldValue
(
$fieldSlug
,
$fieldValue
,
$type
,
'AND'
,
[
'entry_id'
]);
$results
=
$this
->
select
(
$queryForEntryValues
);
if
(
empty
(
$results
)
||
0
>=
count
(
$results
))
{
return
[];
}
$results
=
$this
->
reduceResultsToEntryId
(
$results
);
/**
* Select entries by form ID
*
* @param string $formId ID of form to select
*
* @param bool $addValues Optional Add entry values? Default is true.
* @return array
*/
public
function
selectByFormId
(
$formId
,
$addValues
=
true
)
{
$query
=
$this
->
getQueries
()
->
entrySelect
()
->
queryByFormsId
(
$formId
);
return
$this
->
collectResults
(
$this
->
select
(
$query
),
$addValues
);
$queryForValues
=
$this
->
getQueries
()
->
entrySelect
()
->
queryByEntryIds
(
$results
);
}
return
$this
->
collectResults
(
$this
->
select
(
$queryForValues
));
}
/**
* Find all entries that have or do not have field with a slug and value
*
* @param string $fieldSlug Field slug
* @param string $fieldValue Field value
* @param bool $have Optional. Default: true. If true query is for fields with this value
*
* @return array
*/
public
function
selectByFieldValue
(
$fieldSlug
,
$fieldValue
,
$have
=
true
)
{
$type
=
$have
?
'equals'
:
'notEquals'
;
$queryForEntryValues
=
$this
->
getQueries
()
->
entryValuesSelect
()
->
queryByFieldValue
(
$fieldSlug
,
$fieldValue
,
$type
,
'AND'
,
[
'entry_id'
]);
$results
=
$this
->
select
(
$queryForEntryValues
);
if
(
empty
(
$results
)
||
0
>=
count
(
$results
))
{
return
[];
}
$results
=
$this
->
reduceResultsToEntryId
(
$results
);
/**
* Delete all entry data, including field values for a collection of entries
*
* @param array $entryIds Entry Ids to delete
* @return $this
*/
public
function
deleteByEntryIds
(
array
$entryIds
)
{
$this
->
delete
(
$this
->
getQueries
()
->
entryDelete
()
->
deleteByEntryIds
(
$entryIds
)
);
$this
->
delete
(
$this
->
getQueries
()
->
entryValueDelete
()
->
deleteByEntryIds
(
$entryIds
)
);
$queryForValues
=
$this
->
getQueries
()
->
entrySelect
()
->
queryByEntryIds
(
$results
);
return
$this
;
}
return
$this
->
collectResults
(
$this
->
select
(
$queryForValues
))
;
}
/**
* Delete all entries and entry values by user ID
*
* @param int $userId
*/
public
function
deleteByUserId
(
$userId
)
{
$entries
=
$this
->
select
(
$this
->
getQueries
()
->
entrySelect
()
->
queryByUserId
(
$userId
)
);
if
(
!
empty
(
$entries
))
{
$ids
=
$this
->
reduceResultsToEntryId
(
$entries
,
'id'
);
$this
->
delete
(
$this
->
getQueries
()
->
entryDelete
()
->
deleteByEntryIds
(
$ids
)
);
$this
->
delete
(
$this
->
getQueries
()
->
entryValueDelete
()
->
deleteByEntryIds
(
$ids
)
);
}
}
/**
* Delete all entry data, including field values for a collection of entries
*
* @param array $entryIds Entry Ids to delete
* @return $this
*/
public
function
deleteByEntryIds
(
array
$entryIds
)
{
$this
->
delete
(
$this
->
getQueries
()
->
entryDelete
()
->
deleteByEntryIds
(
$entryIds
)
);
$this
->
delete
(
$this
->
getQueries
()
->
entryValueDelete
()
->
deleteByEntryIds
(
$entryIds
)
);
/**
* @return string
*/
protected
function
entryValueTableName
()
{
return
"
{
$this
->
wpdb
->
prefix
}
cf_form_entry_values"
;
}
return
$this
;
}
/**
* @return string
*/
protected
function
entryTableName
()
{
return
"
{
$this
->
wpdb
->
prefix
}
cf_form_entries"
;
}
/**
* Delete all entries and entry values by user ID
*
* @param int $userId
*/
public
function
deleteByUserId
(
$userId
)
{
$entries
=
$this
->
select
(
$this
->
getQueries
()
->
entrySelect
()
->
queryByUserId
(
$userId
)
);
if
(
!
empty
(
$entries
))
{
$ids
=
$this
->
reduceResultsToEntryId
(
$entries
,
'id'
);
$this
->
delete
(
$this
->
getQueries
()
->
entryDelete
()
->
deleteByEntryIds
(
$ids
)
);
$this
->
delete
(
$this
->
getQueries
()
->
entryValueDelete
()
->
deleteByEntryIds
(
$ids
)
);
}
}
/**
* Collect results using Caldera_Forms_Entry_Entry and Caldera_Forms_Entry_Field to represent values
*
* @param \stdClass[] $entriesValues
* @return array
*/
private
function
collectResults
(
$entriesValues
)
{
$results
=
[];
foreach
(
$entriesValues
as
$entry
)
{
$entry
=
new
\Caldera_Forms_Entry_Entry
(
$entry
);
$query
=
$this
->
getQueries
()
->
entryValuesSelect
()
->
queryByEntryId
(
$entry
->
id
);
$entriesValues
=
$this
->
select
(
$query
);
/**
* @return string
*/
protected
function
entryValueTableName
()
{
return
"
{
$this
->
wpdb
->
prefix
}
cf_form_entry_values"
;
}
$entryValuesPrepared
=
$this
->
collectEntryValues
(
$entriesValues
);
$results
[]
=
[
'entry'
=>
$entry
,
'values'
=>
$entryValuesPrepared
];
}
return
$results
;
}
/**
* @return string
*/
protected
function
entryTableName
()
{
return
"
{
$this
->
wpdb
->
prefix
}
cf_form_entries"
;
}
/**
* Collect
entry values as
Caldera_Forms_Entry_Field
object
s
*
* @param \stdClass[] $entriesValues
* @return array
*/
private
function
collectEntryValues
(
$entriesValues
):
array
{
$entryValuesPrepared
=
[];
if
(
!
empty
(
$entriesValues
))
{
foreach
(
$entriesValues
as
$entry
Value
)
{
$entryValuesPrepared
[]
=
new
\Caldera_Forms_Entry_
Field
(
$entry
Value
);
}
}
return
$
entryValues
Prepared
;
}
/**
* Collect
results using Caldera_Forms_Entry_Entry and
Caldera_Forms_Entry_Field
to represent value
s
*
* @param \stdClass[] $entriesValues
* @param bool $addValues Optional Add entry values? Default is true.
* @return array
*/
private
function
collectResults
(
$entriesValues
,
$addValues
=
true
)
{
$results
=
[];
foreach
(
$entriesValues
as
$entry
)
{
$entry
=
new
\Caldera_Forms_Entry_
Entry
(
$entry
);
$query
=
$this
->
getQueries
()
->
entryValues
Select
()
->
queryByEntryId
(
$entry
->
id
);
/**
* Do a select query
*
* @param SelectQueryBuilder $query
* @return \stdClass[]
*/
private
function
select
(
SelectQueryBuilder
$que
ry
)
{
return
$this
->
getQueries
()
->
select
(
$query
)
;
}
$entryValuesPrepared
=
[];
if
(
$addValues
)
{
$entriesValues
=
$this
->
select
(
$query
);
$entryValuesPrepared
=
$this
->
collectEntryValues
(
$entriesValues
);
}
$results
[]
=
[
'entry'
=>
$ent
ry
,
'values'
=>
$entryValuesPrepared
];
}
return
$results
;
}
/**
* Do a delete query
*
* @param DeleteQueryBuilder $query
* @return \stdClass[]
*/
private
function
delete
(
DeleteQueryBuilder
$query
)
{
return
$this
->
getQueries
()
->
delete
(
$query
);
}
/**
* Collect entry values as Caldera_Forms_Entry_Field objects
*
* @param \stdClass[] $entriesValues
* @return array
*/
private
function
collectEntryValues
(
$entriesValues
):
array
{
$entryValuesPrepared
=
[];
if
(
!
empty
(
$entriesValues
))
{
foreach
(
$entriesValues
as
$entryValue
)
{
$entryValuesPrepared
[]
=
new
\Caldera_Forms_Entry_Field
(
$entryValue
);
}
}
return
$entryValuesPrepared
;
}
/**
* @param $results
* @return array
*/
private
function
reduceResultsToEntryId
(
$results
,
$colum
=
'entry_id'
)
{
foreach
(
$results
as
&
$result
)
{
$result
=
$result
->
$colum
;
}
return
$results
;
}
/**
* Do a select query
*
* @param SelectQueryBuilder $query
* @return \stdClass[]
*/
private
function
select
(
SelectQueryBuilder
$query
)
{
return
$this
->
getQueries
()
->
select
(
$query
);
}
/**
* Do a delete query
*
* @param DeleteQueryBuilder $query
* @return \stdClass[]
*/
private
function
delete
(
DeleteQueryBuilder
$query
)
{
return
$this
->
getQueries
()
->
delete
(
$query
);
}
/**
* @param $results
* @return array
*/
private
function
reduceResultsToEntryId
(
$results
,
$colum
=
'entry_id'
)
{
foreach
(
$results
as
&
$result
)
{
$result
=
$result
->
$colum
;
}
return
$results
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment