PHP code example of dszczer / lister

1. Go to this page and download the library: Download dszczer/lister 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/ */

    

dszczer / lister example snippets


// app/AppKernel.php
// ...
$bundles = [
    // ...
    new Dszczer\ListerBundle\DszczerListerBundle()
];

// ...


// src/AppBundle/Controller/AppController.php

public function listAction(Request $request)
{
    // use factory to create new lister
    $list = $this->get('lister.factory')->createList(
        '\\Full\\Class\\Name\\Of\\ModelCriteria\\Query\\Object', // full class name of Propel query object
        'exampleOneList', // unique list identifier
        'lister' // translation domain
    );
    
    // create some basic list
    // NOTICE: order of adding items does matter!
    $list
        ->addField('id', 'Id')
        ->addField('username', 'Username', true, Filter::TYPE_TEXT)
        ->addField('email', 'E-mail', true, Filter::TYPE_TEXT);
    
    return $this->render(
        'AppBundle:User:list.html.twig',
        ['list' => $list->apply($request)]
    );
}