Git Product home page Git Product logo

lister's Introduction

Lister Bundle

Build Status

Disclaimer: documentation and test suit is not complete. This bundle is in development stage.

Requirements

PHP >7.0.0

Symfony ~2.8

(Symfony ~3.0 not tested, may work)

Doctrine ORM ~2.0 or Propel ORM ~2.0

(Propel ~3.0 not tested)

Installation

  1. Copy files via Composer: composer require dszczer/lister.
  2. Place configuration if needed:
# app/config.yml

# Full Lister Configuration
lister:
    orm: auto # [auto, doctrine, propel]; 'auto' for auto detection, and using both of ORMs simultaneously also
    perpage: 25 # any integer above 0
    form_name_prefix: 'lister_filters'
    use_csrf: true
    
# Minimum Lister Configuration
# Above values are default ones, no need to place any configuarion node
  1. Add routing:
# app/config/routing.yml
lister:
    resource: "@DszczerListerBundle/Resources/config/routing.yml"
    type:     yaml
  1. Enable bundle in AppKernel:
// app/AppKernel.php
// ...
$bundles = [
    // ...
    new Dszczer\ListerBundle\DszczerListerBundle()
];

// ...

Basic usage

<?php
// 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)]
    );
}
{# src/AppBundle/Resources/views/User/list.html.twig #}

{{ lister_filters(list) }}
{{ lister_body(list) }}
{{ lister_pagination(list) }}

lister's People

Contributors

dszczer avatar

Stargazers

Max Kotliar avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.