Download the PHP package omatech/editora-dbinterface without Composer

On this page you can find all versions of the php package omatech/editora-dbinterface. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package editora-dbinterface

Editora-Extractor

Extract info from omatech Editora using closure Eloquent like functions

First make a new instance

Extract information using the extractor

findInstanceByIdAllElements($inst_id, $params = null, $num = null, $level = 1, callable $callback = null)

findInstanceById($inst_id, $params, callable $callback = null);

findInstancesInClass($class, $num=null, $params=null, callable $callback = null)

Extraction params

findInstancesInList($inst_ids, $num=null, $class=null, $params = null, callable $callback = null)

Note: The order of the extraction is forced by the order of the IDs in the list

findInstancesBySearch($query, $num=null, $class=null, $params = null, callable $callback = null)

Note: The order of the extraction is forced by the relevance of the search term (query)

findRelatedInstances($inst_id, $relation, $num=null, $params = null, callable $callback = null)

Extraction params

findChildrenInstances($inst_id, $relation, $num=null, $params = null, callable $callback = null)

(same as findRelatedInstances but forcing child direction)

findParentInstances($inst_id, $relation, $num=null, $params = null, callable $callback = null)

(same as findRelatedInstances but forcing parent direction)

Instance Params

The instance params affect the behaviour of the extraction of the instance itself

Additional calls

findClass($class)

findRelation($relation)

findParentRelation($relation, $inst_id)

findChildRelation($relation, $inst_id)

clearExtractionCache($extraction_cache_key);

Global Params

The format of the params is a key value par in an array, for example:

$params = [ 'lang' => 'es' , 'debug' => false , 'metadata' => true . 'show_inmediate_debug' => true ];

The global params can be:

Combine extractions with the callable parameter

    $result = $extractor->findInstanceById($id, $params, function ($i) use ($extractor){
        $blocks = $extractor->findChildrenInstances($i, "blocks", null, null, function ($i) use ($extractor){
            $boxes = $extractor->findChildrenInstances($i, "boxes", null, null, null);
            return array_merge($boxes);
        });
        return array_merge($blocks);
    });

How Cache works?

By default all the instances that get extracted from the CMS are cached in memcache, to avoid that behaviour you must set the avoid_cache param.

The instance itself is saved in memcache with the following key: DATABASE_NAME:dbinterface:LANGUAGE:INST_ID:FILTER

The instance cache has an expiration time of 3600 seconds by default but can be changed using the cache_expiration param.

If the instance cached is modified in the CMS the cache is automatically expired, the column update_date is the reference to expire the cache of the instance

If you need to use a cache at an extraction level you can use the built in extraction caching system.

The extraction gets cached until the extraction_cache_expiration seconds are reached, so you must be responsible to clear the cache if you need to or to setup a time brief enough to not get stale content from the CMS

The extraction is saved in memcache with the following key DATABASE_NAME::extractor_cache:EXTRACTION_CACHE_KEY:LANGUAGE

Use the function $e->clearExtractionCache(extraction_cache_key) to clear a particular key (the same that you use extraction_cache_key

Pagination

In the main calls of the extractor you can use pagination syntax in the $num parameter, for example:

How to get more info about the pagination once used?

Use the call getPaginator to get all the relevant information about the paginated results.

getPaginator ($prefix='', $postfix='')

for example:

This will generate the following output (assuming that the last pagination option was 10/3 third page with 10 elements and that the total records are 51)

Get last updated timestamp from a given extraction

$extractor->last_updated_timestamp; Returns the last updated unix timestamp of all the elements extracted

Test the Extractor

1) Create a database if not exists with utf8_mb4 and collate utf8_mb4_general_ci in this example assume editora_test in localhost, we'll assume user root and without password 2) Go to Commands folder

cd Commands

3) Generate the editora structure (remember to change your database connection params)

php generate-editora.php --from=file --inputformat=array --inputfile=../data/sample_editora_array.php --to=db4 --dbtohost=localhost --dbtouser=root --dbtopass= --dbtoname=editora_test

The command will output 2 users with random passwords, for example:

New user: omatech with password eJjZQU&5 New user: test with password 6r4!QBPB

4) Populate the editora with fake content

php fake-content.php --to=db4 --dbhost=localhost --dbuser=root --dbpass= --dbname=editora_test --num_instances=6

The command will output something like this:

Content created: 126 instances 959 attributes and 126 relation instances created with batch_id=1533716151

Note: If you want to remove this fake data in the future you can use:

php remove-content.php --to=db4 --dbhost=localhost --dbuser=root --dbpass= --dbname=editora_test --batch_id=1533716151

5) Go to the root folder of the project

cd ..

6) Run the tests to see that everything is fine!

In windows

phpunit ./tests/Omatech/Editora/Extractor/ExtractorTest

o in Linux

vendor/bin/phpunit ./tests/Omatech/Editora/Extractor/ExtractorTest

Editora-Loader

Compare methods

relationInstanceExist($rel_id, $parent_inst_id, $child_inst_id)

existsInstanceWithExternalID($class_id, $external_id)

ExistingInstanceIsDifferent($inst_id, $nom_intern, $values, $status = 'O', &$difference, &$attr_difference)

    // -1 instance not exist
    // -2 status is different
    // -3 nom_intern is different
    // -4 some value is different
    // -5 some value not exists in current instance
    // 0 same!

Insert/Update methods

insertRelationInstance($rel_id, $parent_inst_id, $child_inst_id, $external_id = null, $batch_id = null)

updateInstance($inst_id, $nom_intern, $values, $status = 'O', $publishing_begins = null, $publishing_ends = null)

insertInstanceWithExternalID($class_id, $nom_intern, $external_id, $batch_id, $values, $status = 'O', $publishing_begins = null, $publishing_ends = null, $creation_date = 'now()', $update_date = 'now()') {

insertInstance($class_id, $nom_intern, $values, $status = 'O', $publishing_begins = null, $publishing_ends = null)

insertInstanceForcingID($inst_id, $class_id, $nom_intern, $values, $status = 'O', $publishing_begins = null, $publishing_ends = null)

updateUrlNice($nice_url, $inst_id, $language)

insertUrlNice($nice_url, $inst_id, $language)

Delete methods

deleteInstance ($inst_id)

deleteInstancesWithExternalID ($external_id, $class_id)

deleteRelationInstancesWithExternalID($external_id, $rel_id)

delete_instance($inst_id)

deleteInstancesInBatch($batch_id)

deleteRelationInstancesInBatch($batch_id)

deleteRelationInstance($id)

Commands

Editora Structure

generate-editora.php

Generate editora structure from an array or json file

reverse-engineer-editora.php

Takes out the editora structure and generates a compatible generator file

compare-editoras.php

Compare two editora structures in two local databases, get a report of the differences between them

modernize.php

Modernize editora DB to include latest changes in DB structure

regenerate-passwords.php

Reset all the passwords in the database using a string with uppercase, lowercase, symbols and numbers

Content manipulation

fake-content.php

Populate the editora CMS with fake content

export-content.php

Export all editora contents to a file or input (json or serialized array)

import-content.php

Import all editora contents from a file or input (json or serialized_array)

remove-content.php

Remove all content with a given batch_id or all content except Global and Home if delete_previous_data flag is present

Translation

export-translation.php

Export strings in one language from editora database to excel file or output

import-translation.php

Import strings from an excel, json file or input to editora database

Experimental

data-transfer.php

Use data_transfer.php to extract editora4 information and get it into editora5 format

translate.php

Use Google translate API to automatically translate content

migrator.php

Use migrator.php to extract editora4 information and get it into editora5 format, transfer directly to a db5 database or generate 3 different file formats (full, minimal, generator)

export-allinstances-mongo

Export all instances to the output or a file in json format.

Attributes types:

Class diagram

Authors

License

This project is licensed under the MIT License


All versions of editora-dbinterface with dependencies

PHP Build Version
Package Version
Requires doctrine/orm Version ^2.19.5
phpoffice/phpspreadsheet Version 1.*
jawira/plantuml-encoding Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package omatech/editora-dbinterface contains the following files

Loading the files please wait ....