Code Monkey home page Code Monkey logo

sqlquerywrapper's Introduction

SqlQueryWrapper

2018-04-17 -> 2021-03-05

A wrapper for the SqlQuery planet, used to display lists in a front.

This is part of the universe framework.

Install

Using the planet installer via light-cli

lt install Ling.SqlQueryWrapper

Using the uni command.

uni import Ling/SqlQueryWrapper

Or just download it and place it where you want otherwise.

How to

Example in a kamille app.

<?php 


//... in a controller...

$sqlQuery = SqlQuery::create(); // configure your sqlQuery here...

$wrapper = SqlQueryWrapper::create() 
    ->setSqlQuery($sqlQuery)
    ->setPlugin("pagination", SqlQueryWrapperPaginationPlugin::create()->setNumberOfItemsPerPage(5))
    ->setPlugin("sort", SqlQueryWrapperSortPlugin::create()->setSortItems([
        "label_asc" => "Nom ascendant",
        "label_desc" => "Nom descendant",
        "price_asc" => "Prix ascendant",
        "price_desc" => "Prix descendant",
        "popularity_desc" => "Popularité",
    ]))
    // ->setPlugin("price_filter", EkomSqlQueryWrapperPriceFilterPlugin::create()->setRange(0, 10000)) // we can add any number of plugins we want :) 
    ->prepare();

More doc

A list is separated between the sqlQuery on the model side, and the list widget on the view side.

A plugin has a foot on each side, it's an element that:

  • listens to uri params and interacts with the sqlQuery on the model side
  • provides a model (i.e. array of properties) for the view side

The SqlQuery by default should be such as the rows it returns are not filtered (no pagination, no order, no filters), it basically just focuses on returning the right row structure.

The list pagination, order and filters are provided by the plugins.

History Log

  • 1.6.4 -- 2021-05-31

    • Removing trailing plus in lpi-deps file (to work with Light_PlanetInstaller:2.0.0 api
  • 1.6.3 -- 2021-03-05

    • update README.md, add install alternative
  • 1.6.2 -- 2020-12-08

    • Fix lpi-deps not using natsort.
  • 1.6.1 -- 2020-12-04

    • Add lpi-deps.byml file
  • 1.6.0 -- 2018-06-11

    • add SqlQueryWrapper.doGetNbItems protected method
    • add SqlQueryWrapper.doGetRows protected method
  • 1.5.0 -- 2018-05-25

    • add SqlQueryWrapperBasePlugin.setContext method
  • 1.4.1 -- 2018-05-25

    • fix SqlQueryWrapper.getNumberOfItems return int
  • 1.4.0 -- 2018-05-11

    • add SqlQueryWrapperInterface.getNumberOfItems method
  • 1.3.0 -- 2018-05-02

    • add SqlQueryWrapperInterface.setPlugin method
  • 1.2.0 -- 2018-04-23

    • add SqlQueryWrapperSortPlugin.appendSortItems and prependSortItems methods
  • 1.1.0 -- 2018-04-17

    • add SqlQueryPluginInterface onQueryReady method
  • 1.0.0 -- 2018-04-17

    • initial commit

sqlquerywrapper's People

Contributors

lingtalfi avatar

Watchers

 avatar James Cloos 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.