PHP code example of view-components / doctrine-data-processing

1. Go to this page and download the library: Download view-components/doctrine-data-processing 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/ */

    

view-components / doctrine-data-processing example snippets


use Doctrine\DBAL\Query\QueryBuilder;
use ViewComponents\Doctrine\DoctrineDataProvider;
use ViewComponents\ViewComponents\Data\Operation\FilterOperation;

$builder = new QueryBuilder($doctrineConnection);
$builder
    ->select('*')
    ->from('test_users');
$provider = new DoctrineDataProvider($builder);
$provider->operations()->add(
    new FilterOperation('role', FilterOperation::OPERATOR_EQ, 'Manager')
);
foreach ($provider as $user) {
   var_dump($user);
}