Skip to content

garex/oopconfig-cakephp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OOP config module for CakePHP

Module for OOP config, for CakePHP. Helps to get complex config arrays in OOP way with code completion and documentation.

    // Manual way
    $conditions = array(
        'conditions' => array(
            'Model.field' => 123,
            'Model.field5 BETWEEN ? AND ?' => array(5, 5),
            'Model.field8 NOT LIKE' => '%8%',
        ),
        'recursive'  => 1,
        'fields'     => array('Model.field1', 'DISTINCT Model.field2'),
        'order'      => array('Model.created', 'Model.field3 DESC'),
        'group'      => array('Model.field'),
        'limit'      => 100,
        'page'       => 1,
        'offset'     => 10,
        'callbacks'  => true,
    );
    
    // OOP config way
    $conditions = $this->findParams
        ->conditions
            ->is('Model.field', 123)
            ->between('Model.field5', 5, 5)
            ->notLike('Model.field8', '%8%')
            ->up()
        ->recursive(1)
        ->fields('Model.field1', 'DISTINCT Model.field2')
        ->order('Model.created', 'Model.field3 DESC')
        ->group('Model.field')
        ->limit(100)->page(1)->offset(10)
        ->callbacks(true)
        ->get()
    ;

Example config array is taken from Retrieving Your Data

About

Driver for OOP config for CakePHP. @see oopconfig

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published