PHP code example of esit / databaselayer

1. Go to this page and download the library: Download esit/databaselayer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

esit / databaselayer example snippets


use \Esit\Databaselayer\Classes\Services\Helper\DatabaseHelper;

myClass
{

    private DatabaseHelper $dbHelper;

    public function __construct(DatabaseHelper $dbHelper)
    {
        $this->dbHelper = $dbHelper;
    }

    public function myTest(): void
    {
        // lesende Operationen
        $row        = $this->dbHelper->loadByValue(12, 'id', 'tl_member');
        $collection = $this->dbHelper->loadByList([12, 13, 14 ,15], 'id', 'tl_member');

        // schreibende Operationen
        unset($row['id']);  // Id muss unique sein!
        $id = $this->dbHelper->insert($row, 'tl_member');
        $this->dbHelper->update($row, 16, 'tl_member');
        $this->dbHelper->delete(16, 'tl_member');

        // Verwendung des QueryBuilders
        $query  = $this->dbHelper->getQueryBuilder();
        $query->select('*')->from('tl_member')->where->('id > :id')->setParameter('id', 12);
        $result = $query->executeQuery();
    }
}