From dd1c9919ce4de87c3a13b4de59d51c8a48d27204 Mon Sep 17 00:00:00 2001 From: Josh Pollock <josh@calderawp.com> Date: Thu, 5 Apr 2018 21:47:10 -0400 Subject: [PATCH] document simple quries --- README.md | 32 ++++++++++++++++++++++++++++- Tests/Integration/FunctionsTest.php | 2 ++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 444f297..1a8c818 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,37 @@ [](https://travis-ci.org/calderawp/caldera-forms-query) +## Usage -## Development +```php +/** + * Examples of simple queries + * + * Using the class: \calderawp\CalderaFormsQuery\Features\FeatureContainer + * Via the static accessor function: calderawp\CalderaFormsQueries\CalderaFormsQueries() + */ + +/** First make the function usable without a full namespace */ +use function calderawp\CalderaFormsQueries\CalderaFormsQueries; + +/** Do Some Queries */ +//Select all data by user ID +$entries = CalderaFormsQueries()->selectByUserId(42); + +//Select all entries that have a field whose slug is "email" and the value of that field's value is "delete@please.eu" +$entries = CalderaFormsQueries()->selectByFieldValue( 'email', 'delete@please.eu' ); +//Select all entries that do not have field whose slug is "size" and the value of that field's value is "big" +$entries = CalderaFormsQueries()->selectByFieldValue( 'size', 'big', false ); +//Delete all data by Entry ID +CalderaFormsQueries()->deleteByEntryIds([1,1,2,3,5,8,42]); + +//Delete all data by User ID +CalderaFormsQueries()->deleteByUserId(42); +``` + + +## Development ### Install Requires git and Composer @@ -39,3 +67,5 @@ Run these commands from the plugin's root directory. * Fix All Code Formatting - `composer formatting` +## Stuff. +Copyright 2018 CalderaWP LLC. License: GPL v2 or later. diff --git a/Tests/Integration/FunctionsTest.php b/Tests/Integration/FunctionsTest.php index 44ce160..279d236 100644 --- a/Tests/Integration/FunctionsTest.php +++ b/Tests/Integration/FunctionsTest.php @@ -28,4 +28,6 @@ class FunctionsTest extends IntegrationTestCase CalderaFormsQueries()->set('sivan', 'roy' ); $this->assertEquals( 'roy', CalderaFormsQueries()->get('sivan') ); } + + } \ No newline at end of file -- GitLab