Skip to content

[READ-ONLY] Caldera framework database abstraction. WordPress custom table utility Library

Notifications You must be signed in to change notification settings

CalderaWP/caldera-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caldera DB

👀🌋 This Is A Module Of The Caldera Framework

Install

  • Add to your package:
    • composer require calderawp/http
  • Install for development:

Overview

This package provides database table creation and basic queries.

Tables schemas are defined using YAML. As of now, only WPDB integration is available.

Caldera Forms Tables

V1 Tables

V2 Tables

Create Table From Attributes

use calderawp\DB\Factory;
use calderawp\interop\Attribute;

//id column
$attributeData = [
    'name' => 'id',
    'sqlDescriptor' => 'int(11) unsigned NOT NULL AUTO_INCREMENT',
    'format' => '%d',
];

//name column
$attribute2Data = [
    'name' => 'name',
    'sqlDescriptor' => 'varchar(256) NOT NULL',
    'format' => '%s',
];

//name of table
$tableName = 'cf_whatever';
//name of primary key(s)
$primaryKey = 'id';
//name of index(es)
$indexes = ['name'];

//Create factory
$factory = new Factory();
//Create Table schema
$attributes = [$attributeData, $attribute2Data];
$tableSchema = $factory->tableSchema($attributes, $tableName, $primaryKey, $indexes);
//Create table using WordPress' wpdb
$table = $factory->wordPressDatabaseTable($tableSchema,$wpdb);

License, Copyright, etc.

Copyright 2018+ CalderaWP LLC and licensed under the terms of the GNU GPL license. Please share with your neighbor.

About

[READ-ONLY] Caldera framework database abstraction. WordPress custom table utility Library

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages