PHP code example of intaro / custom-index-bundle

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

    

intaro / custom-index-bundle example snippets





return [
   ...
    Intaro\CustomIndexBundle\IntaroCustomIndexBundle::class => ['all' => true],
];



namespace Acme\MyBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Intaro\CustomIndexBundle\Metadata\Attribute\CustomIndex;

#[ORM\Table(name:'my_entity')]
#[ORM\Entity]
#[CustomIndex(columns: ['my_property1'])]
#[CustomIndex(columns: ['lower(my_property1)', 'lower(my_property2)'])]
class MyEntity
{
    #[ORM\Column(type:'string', length: 256)]
    private $myProperty1;
    #[ORM\Column(type:'string', length: 256)]
    private $myProperty2;
}



#[CustomIndex(columns: ['lower(my_column) gist_trgm_ops'], using: 'gist')]



#[CustomIndex(columns: ['lower(my_column1)', 'nullif(true, not my_column2 isnull)'], unique: true)]



#[CustomIndex(columns: ['site_id'], where: 'product_id IS NULL')]