Documentation

CFOs
in package

[$cfos = $this->core->loadClass('CFOs');] Class CFOs to handle CFO app for CloudFrameworkInterface https://www.notion.so/cloudframework/CFI-PHP-Class-c26b2a1dd2254ddd9e663f2f8febe038 last_update: 202201

Table of Contents

Properties

$avoid_secrets  : mixed
$bqObjects  : mixed
$core  : Core7
$db_connection  : mixed
$dbObjects  : mixed
$dsObjects  : mixed
$error  : mixed
$errorMsg  : mixed
$integrationKey  : string
$keyId  : mixed
$lastDBObject  : CloudSQL
$namespace  : mixed
$project_id  : mixed
$secrets  : mixed
$service_account  : mixed
$version  : mixed

Methods

__construct()  : mixed
DataSQL constructor.
addError()  : mixed
Add an error in the class
avoidSecrets()  : mixed
If ($avoid==true and if !$this->service_account) the secrets of Datastore, Bigquery, Database CFOs will be tried to be read. False by default
bq()  : DataBQ
Return a bq $object
bqInit()  : bool
Initialize a bq $object
db()  : DataSQL
dbClose()  : mixed
Close Database Connections
dbConnection()  : CloudSQL
dbInit()  : bool
Initialize a bq $object
dbQuery()  : array<string|int, mixed>|void
Execute a Direct query inside a $connection
ds()  : DataStore
dsInit()  : bool
Create a (Datastore) $this->dsObjects[$object] element to be used by ds. If any error it creates a Datastore Foo Object with error message;
getInterfaceModelFromDatastoreModel()  : array<string|int, mixed>
Return a structure with bigquery squema based on CF model
readCFOs()  : array<string|int, mixed>|void
readSecret()  : array<string|int, mixed>|void
resetCache()  : mixed
Reset the cache to load the CFOs
setDBConnection()  : mixed
Set a default DB Connection for CloudSQL. It has to be an array and it will rewrite the secrets included in the CFOs for db
setDBCredentials()  : bool
Assign DB Credentials to stablish connection
setIntegrationKey()  : mixed
Set $this->integrationKey to connect with CFO models
setNameSpace()  : mixed
setProjectId()  : mixed
Set a default project_id overwritting the default project_id
setSecret()  : mixed
Set secrets to be used by Datastore, Bigquery, Database
setServiceAccount()  : mixed
Set a default service account for Datastore and BigQuery Objects. It has to be an array and it will rewrite the secrets includes in the CFOs for ds and bigquery
transformTXTInDatastoreModel()  : array<string|int, mixed>|void
Execute a Manual Query
useCFOSecret()  : mixed
If ($use==true and if !$this->service_account) the secrets of Datastore, Bigquery, Database CFOs will be tried to be read. False by default

Properties

$avoid_secrets

public mixed $avoid_secrets = \true

$bqObjects

public mixed $bqObjects = []

$db_connection

public mixed $db_connection = \null

$dbObjects

public mixed $dbObjects = []

$dsObjects

public mixed $dsObjects = []

$error

public mixed $error = \false

$errorMsg

public mixed $errorMsg = []

$integrationKey

public string $integrationKey = ''

To connect with the ERP

$keyId

public mixed $keyId = \null

$namespace

public mixed $namespace = 'default'

$project_id

public mixed $project_id = \null

$secrets

public mixed $secrets = []

$service_account

public mixed $service_account = \null

$version

public mixed $version = '202301051'

Methods

__construct()

DataSQL constructor.

public __construct(Core &$core[, mixed $integrationKey = '' ]) : mixed
Parameters
$core : Core
$integrationKey : mixed = ''

addError()

Add an error in the class

public addError( $value) : mixed
Parameters
$value :

avoidSecrets()

If ($avoid==true and if !$this->service_account) the secrets of Datastore, Bigquery, Database CFOs will be tried to be read. False by default

public avoidSecrets(bool $avoid) : mixed
Parameters
$avoid : bool

bq()

Return a bq $object

public bq( $object) : DataBQ
Parameters
$object :
Return values
DataBQ

bqInit()

Initialize a bq $object

public bqInit(string $object[, string $project_id = '' ][, array<string|int, mixed> $service_account = [] ]) : bool
Parameters
$object : string
$project_id : string = ''
$service_account : array<string|int, mixed> = []
Return values
bool

db()

public db( $object[, mixed $connection = 'default' ]) : DataSQL
Parameters
$object :
$connection : mixed = 'default'
Return values
DataSQL

dbClose()

Close Database Connections

public dbClose([string $connection = '' ]) : mixed
Parameters
$connection : string = ''

Optional it specify to close a specific connection instead of all

dbConnection()

public dbConnection([string $connection = 'default' ]) : CloudSQL
Parameters
$connection : string = 'default'
Return values
CloudSQL

dbInit()

Initialize a bq $object

public dbInit(string $object[, string $connection = 'default' ][, array<string|int, mixed> $db_credentials = [] ]) : bool
Parameters
$object : string
$connection : string = 'default'

name of the connection

$db_credentials : array<string|int, mixed> = []

optional credentials for the connection

Return values
bool

dbQuery()

Execute a Direct query inside a $connection

public dbQuery( $q[, null $params = null ][, string $connection = 'default' ]) : array<string|int, mixed>|void
Parameters
$q :
$params : null = null
$connection : string = 'default'
Return values
array<string|int, mixed>|void

dsInit()

Create a (Datastore) $this->dsObjects[$object] element to be used by ds. If any error it creates a Datastore Foo Object with error message;

public dsInit(string $object[, string $namespace = '' ][, string $project_id = '' ][, array<string|int, mixed> $service_account = [] ]) : bool
Parameters
$object : string
$namespace : string = ''
$project_id : string = ''
$service_account : array<string|int, mixed> = []

Optional parameter to

Return values
bool

getInterfaceModelFromDatastoreModel()

Return a structure with bigquery squema based on CF model

public getInterfaceModelFromDatastoreModel(mixed $entity, mixed $model, mixed $group[, mixed $secret_id = '' ]) : array<string|int, mixed>
Parameters
$entity : mixed
$model : mixed
$group : mixed
$secret_id : mixed = ''
Return values
array<string|int, mixed>

readCFOs()

public readCFOs( $cfos) : array<string|int, mixed>|void
Parameters
$cfos :
Return values
array<string|int, mixed>|void

if there is no error return an array with the model structure

readSecret()

public readSecret(string $secret) : array<string|int, mixed>|void
Parameters
$secret : string
Return values
array<string|int, mixed>|void

return the secret array of there is not errors

resetCache()

Reset the cache to load the CFOs

public resetCache() : mixed

setDBConnection()

Set a default DB Connection for CloudSQL. It has to be an array and it will rewrite the secrets included in the CFOs for db

public setDBConnection(array<string|int, mixed> $db_connection) : mixed
Parameters
$db_connection : array<string|int, mixed>

setDBCredentials()

Assign DB Credentials to stablish connection

public setDBCredentials(array<string|int, mixed> $credentials[, string $connection = 'default' ]) : bool
Parameters
$credentials : array<string|int, mixed>

Varaibles to establish a connection $credentials['dbServer'] $credentials['dbUser'] $credentials['dbPassword']??null); $credentials['dbName']??null); $credentials['dbSocket']??null); $credentials['dbProxy']??null); $credentials['dbProxyHeaders']??null); $credentials['dbCharset']??null); $credentials['dbPort']??'3306');

$connection : string = 'default'

Optional name of the connection. If empty it will be default

Return values
bool

setIntegrationKey()

Set $this->integrationKey to connect with CFO models

public setIntegrationKey( $key) : mixed
Parameters
$key :

setNameSpace()

public setNameSpace( $namespace) : mixed
Parameters
$namespace :

setProjectId()

Set a default project_id overwritting the default project_id

public setProjectId( $project_id) : mixed
Parameters
$project_id :

setSecret()

Set secrets to be used by Datastore, Bigquery, Database

public setSecret( $key, array<string|int, mixed> $value) : mixed
Parameters
$key :
$value : array<string|int, mixed>

setServiceAccount()

Set a default service account for Datastore and BigQuery Objects. It has to be an array and it will rewrite the secrets includes in the CFOs for ds and bigquery

public setServiceAccount(array<string|int, mixed> $service_account) : mixed
Parameters
$service_account : array<string|int, mixed>

transformTXTInDatastoreModel()

Execute a Manual Query

public transformTXTInDatastoreModel(string $txt, string $cfo) : array<string|int, mixed>|void
Parameters
$txt : string
$cfo : string
Return values
array<string|int, mixed>|void

useCFOSecret()

If ($use==true and if !$this->service_account) the secrets of Datastore, Bigquery, Database CFOs will be tried to be read. False by default

public useCFOSecret(bool $use) : mixed
Parameters
$use : bool

        
On this page

Search results