PHP code example of dama / solarium-bundle

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

    

dama / solarium-bundle example snippets


public function registerBundles()
{
    $bundles = array(
        ...
        new \DAMA\SolariumBundle\DAMASolariumBundle(),
        ...
    );
    ...
}

    $client = $this->get('solarium.client');

$client = $this->get('solarium.client');
$select = $client->createSelect();
$select->setQuery('foo');
$results = $client->select($select);

    $defaultClient = $this->get('solarium.client');
    $anotherClient = $this->get('solarium.client.another');

    $firstOneClient = $this->get('solarium.client');
    //or
    $firstOneClient = $this->get('solarium.client.firstOne');

    $anotherOneClient = $this->get('solarium.client.anotherOne');

/** @var DAMA\SolariumBundle\ClientRegistryInterface $registry */
$registry = $this->get('solarium.client_registry');
$firstOne = $registry->getClient('firstOne');
$secondOne = $registry->getClient('secondOne');

$registry = $this->get('solarium.client_registry');
$default = $registry->getClient();