PHP code example of jayparmar271 / cakephp-magic-query

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

    

jayparmar271 / cakephp-magic-query example snippets


return [
  'MagicQuery' => [
    'limit' => 2,
    'page' => 1,
    'orderBy' => ['id' => 'ASC'],
    'hydrate' => false,
    'validate' => true,
  ],
];

/*
 * Load magic query file
 */
if (file_exists(CONFIG . 'magic_query.php')) {
    Configure::load('magic_query');
}

    $this->addBehavior('MagicQuery.Query');

    $this->Users->getRecord(['name'], ['id' => '1']);