PHP code example of alaa / magento2-table-query

1. Go to this page and download the library: Download alaa/magento2-table-query 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/ */

    

alaa / magento2-table-query example snippets


public function __construct(\Alaa\TableQuery\Model\QueryInterfaceFactory $queryFactory)
{
        $this->queryFactory = $queryFactory;
}

$query =  $this->queryFactory->create(['table' => 'my_table', 'primaryId' => 'primary_id']);

$data = [
    [
        'name' => 'some name'
        'age' => 33,
        ...
    ],
    [...]
]
$query->put($data);