PHP code example of bitsystem / searchpro

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

    

bitsystem / searchpro example snippets

 
use Bitsystem\Backend\Image;

//Obtiene la imagen pasada por un formulario
$imageBinary = $request->files->get('image', FALSE);

//Instancia la clase
$image = new Image();
$image->setName($request->request->get('name', NULL));
$image->insertImage($imageBinary, 'course',function($e){
    $e->thumbnail(40,40);
    $e->thumbnail(364,205);
    $e->thumbnail(1080,720);
});

//Retorna un array
$imageSave = $image->save();

//Recorre el array para obtener el path de la imagen
foreach ($imageSave['thumbnails'] as $value){
    $value['route'];
    $value['width'];
    $value['height'];
}

use Bitsystem\SearchPro\Search as Search;

//Campo de busqueda
$textSearch = $request->request->get('q','');

//Parametros del filtro
$filter = $request->request->get('filter','');
$search = new Search($this->getDoctrine()->getManager(), $request);
$result = $search->setTable('Clientes')
    ->addColum([
                'id' => 'id',
                'nombre' => 'nombre'
    ])
    ->selectRow([	1 => 1,
                    10 => [ 10, true ],
                    20 => 20,
                    30 => 30,
                    40 => 40,
                    'Todo' => 'all'
                ])
    ->search('nombre',$textSearch)
    ->getResult();
    return $result;

->addColum([
            'nombre variable' => 'Nombre columna Tabla'
])

->setTable('Nombre tabla')

->addColumForeignKey([
          'POPULATION' => [
                          'type' => 'select',
                          'table' => 'MUNICIPALITY',
                          'columReference' => 'MUNICIPALITY',
                          'colum' => 'POPULATION'
                      ]
     ])
TRUE
TRUE