Skip to content

zucchi/Zucchi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0be244d · Jul 22, 2016

History

70 Commits
Jul 25, 2013
Sep 11, 2015
Feb 15, 2016
Sep 11, 2015
Sep 11, 2015
Sep 4, 2012
Jan 31, 2014
Nov 24, 2015
Aug 6, 2013
Jul 16, 2012
Jul 16, 2012
Sep 11, 2015
Sep 11, 2015
Sep 11, 2015

Repository files navigation

Zucchi Framework Extensions

Custom extensions and additions to Zend Framework 2

This Library uses PHP 5.4 features

Components

  • Controller - Common controller features
  • DateTime - Custom Date/Time objects with pre defined __toString
  • Debug - Debug utilities
  • Event - Event Tools and traits
  • Form - Form factory with custom hydration
  • Image - Generic representation of an Image
  • ServiceManager - Service Manager Tools and Traits
  • Traits - A helper to get the traits of all ancestors
  • View - Custom Helpers and strategies

Request Parser Trait

This trait introduces consistent parsing of parameters in a query string that can then be consumed by appropriate Zucchi Query builder classes

Simple query

?where[forename][value]=john
&where[forname][operator]=fuzzy

Complex nexted where query without explicit field definitions

?where[mode]=and
&where[expressions][0][mode]=or
&where[expressions][0][forename][value]=john
&where[expressions][0][forename][operator]=fuzzy
&where[expressions][0][surname][value]=john
&where[expressions][0][surname][operator]=fuzzy
&where[expressions][0][expressions][0][mode]=and
&where[expressions][0][expressions][0][email][value]=john
&where[expressions][0][expressions][0][email][operator]=fuzzy
&where[expressions][0][expressions][0][username][value]=john
&where[expressions][0][expressions][0][username][operator]=fuzzy
&where[expressions][1][id][value][0]=1
&where[expressions][1][id][operator]=nin

Complex nexted where query with explicit field definitions to allow use of "mode" & "expressions" as a field

?where[mode]=and
&where[expressions][0][mode]=and
&where[expressions][0][fields][forename][value]=john
&where[expressions][0][fields][forename][operator]=fuzzy
&where[expressions][0][fields][mode][value]=active
&where[expressions][0][fields][surname][operator]=eq

Available operators and modes include

    protected $requestOperators = array(
        'is'    => 'is',
        'eq'    => '=',
        'gt'    => '>',
        'gte'   => '>=',
        'lt'    => '<',
        'lte'   => '<=',
        'neq'   => '!=',
        'in'   => 'in',
        'nin'   => 'not in',
        'between' => 'between',
        'fuzzy' => 'like',
        'regex' => 'regexp',
    );

    protected $requestModes = array(
        'or' => 'or',
        'and' => 'and',
    );